Storing a variable into a database
- by Alekx
In an attempt to better learn Rails and I'm building a simple Blackjack game, but I'm running into a problem of storing the variable. I understand how to store user-genereated data into the db using form_for, but I'm struggling to create a random number and put it in the db.
@hand = rand(9) + 2
I have "hand" as a field in my db, just curious how to store this random number. Any help anyone could provide to point me in the right direction would be very much appreciated. Thanks.