Put random ID number in the associated table when to create
I'm trying to put a random id number in my associated table. what do I do?

     def create
       @rand = rand(1...10)
       @player = Player.new(params[:player])
       @player.result_id = @rand
      if @player.save
       render :action => "new"
      else
      render :action => "new"
     end        
   end
Put random ID number in the associated table when to create
===

I'm trying to put a random id number in my associated table. what do I do?

     def create
       @rand = rand(1...10)
       @player = Player.new(params[:player])
       @player.result_id = @rand
      if @player.save
       render :action => "new"
      else
      render :action => "new"
     end        
   end