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

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?

Code:
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 qrcode images everytime in the /public/images/qrcodes/-folder?