Closed ybakos closed 7 years ago
plants.each create qr code in migration
Hi @ybakos,
Before I pull the trigger on this migration, I was hoping you could take a look at it: https://github.com/osu-cascades/ecotone-web/blob/qr-code/db/migrate/20170526185353_add_attachment_qr_code_to_plots.rb
Couple questions
QRCode.new()
takes the url as a parameter, will qrcode = RQRCode::QRCode.new(plot_path(:id))
give us the correct url?Will try to get to this today, 6/26.
@nathanstruhs I think we should avoid storing the generated qrcode image entirely - but correct me if I'm forgetting something. Now that I've had time to take a look at the library, it seems we can just QRCode.new(plot_path(@plot))
in the view for plots#show
, embedding the resulting svg/html in the page with the respectful methods.
Bio users can then just print the page and make a little physical qrcode label (we'll have to experiment with this, for sizing, etc) and ultimately we can have a simple "print qr code" button that makes it a little better.
I think using plot_path
is a smarter approach than plot_url
, since, although the former requires a little string concatenation with a literal hostname, the latter decouples the qrcode from the hostname (in case it changes later).
https://github.com/whomwah/rqrcode