Storing a variable into a database
        Posted  
        
            by 
                Alekx
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Alekx
        
        
        
        Published on 2011-11-27T17:35:47Z
        Indexed on 
            2011/11/27
            17:50 UTC
        
        
        Read the original article
        Hit count: 249
        
ruby-on-rails
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.
© Stack Overflow or respective owner