Topic: Qr Code Tracking Service

Hi,I'm new to this forum and Rails in general.
But to get the ball rolling and learn more i've challenged my self to make a Qr Code Tracking-site.

qrcodetracking.com is the site i'm trying to replicate.
Maybe i've taken water over my head in this project but i got a lot of free time and is really eager to learn more.

So far i've done an easy login/registration to the site with Devise.
Now i'm trying to figure out how the barby-gem (gem for generating barcodes) is working.As I said, i'm new to this and would love to get some feedback/directions on where to go next?
For example, how would you do the "generate_qr_code"-function? How would you go on and organize the database?

barcode = Barby::QrCode.new('http://google.com', :level => :l)
File.open('qrcode.png','wb') do |f|
f << barcode.to_png(:xdim => 20)
end

That is what i got right now, but it doesn't overwrite the qrcode.png in the public/images/ instead it is saved to the root directory?
I also tried the rmagick-outputter but the image just comes out blank, have no clue why?

I'd also like if someone kind could help me out with what kind of controllers/models you think would be needed for this site?

Sorry for my sloppy english. smile
I'll be back with more questions later.

Mats

Last edited by matsmaatson (2011-05-18 07:51:38)

Re: Qr Code Tracking Service

  def create_qr_code
    
    barcode = Barby::QrCode.new('DATA', :level => :l)
    File.open('qrcode.png','wb') do |f|
    f << barcode.to_png(:xdim => 20)
    end
  end

This is my first create_qr_code function, but i don't understand how to get the data from the form to be put into the function?
I'm also wondering if i am suppose to put this function in the controller or the model, i'm thinking the model and then do something like @qrcode.create_qr_code in the controller-create?
And the last question right now, how could I make this function save different qrcodes images everytime in the /public/images/qrcodes/-folder?