Hi everyone! I have a view that outputs several versions of the same
form, and I want the user to be able to fill all of them out, and hit
submit once. When that happens, I want each form entry to be submitted
into a database table. I just don’t know how to do that. Here’s what I
have now:
<%= game.home_team.name %> | <%= text_field 'guess', 'hometeam_score' %> | <%= text_field 'guess', 'visitingteam_score' %> | <%= game.away_team.name %> | <%= game.gameweek %> |
<%= submit_tag “Submit” %>
And the controller:
def create
@guess = Guess.new(params[:guess])
if @guess.save
flash[:notice] = ‘
Your game has been
saved.
redirect_to :controller => ‘guess’, :action => ‘index’
else
render :action => ‘new’
end
end
I don’t know how to tell the controller to take each of those tr forms
and process them seperately. I’m sure this is easy, but I’ve never done
something like this before.
Thanks!