how to generate qrcode on ror
洪梓
2023-12-01
1. In your rails project, install the plugin by following command:
./script/plugin install http://qrcode-rails.googlecode.com/svn/trunk/plugins/qrcode
2. Add javascript include tag in HTML header:
<%= javascript_include_tag :defaults %>
3. Add following funtion to where you want to generate QRCode.
<%= qrcode('http://www.google.com/', 2) %>
* The first parameter is URL
* The second optional parameter is pixel size.
4. Done!
For details, please check the QRCode project page.
Sample Code
<%= qrcode('http://www.google.com/', 8 ) %>