I am using rqrcode gem. It is quite simple and you do not need to create images for your qrcodes. The code is generated using tables and some CSS styles ...
You can use this helper: /helpers/qrcode_helper.rb
module QrcodeHelper require 'rqrcode' def render_qr_code text, size = 3 return if text.to_s.empty? qr = RQRCode::QRCode.new(text) sizeStyle = "width: #{size}px; height: #{size}px;" content_tag :table, class: "qrcode pull-right" do qr.modules.each_index do |x| concat(content_tag(:tr) do qr.modules.each_index do |y| color = qr.dark?(x, y) ? 'black' : 'white' concat content_tag(:td, nil, class: color, style: sizeStyle) end end) end end end end
In your opinion some_view.html.erb
<%= render_qr_code("MYCODE") %>
And you need to add style for your qrcode.css.less code .
table.qrcode { border-width: 0; border-style: none; border-color:
In my example, it works with Rails 3.
source share