Sorry I never got back to you on this. Somehow I missed your reply. Here's how I would do it.
Create three tables, phrases, users, and guesses. In this case, User has_many :guesses and Guess belongs_to both :user and :phrase.
If I understand you correctly, you want to take, say, three phrases and have each user make a guess for each phrase. In the "new" controller action, create the default User model with blank Guesses, one for each phrase you want to guess. Like this:
def new
@user = User.new # Fetch the phrases however you like here:
Phrase.find(:all).each do |phrase|
@user.guesses.build(:phrase => phrase)
end
end
Now that you have the empty User and guesses, display them in the form similar to how I mentioned in the other post:
<%= start_form_tag :action => 'create' %>
<p>Name: <%= text_field :user, :name %></p>
<p>Email: <%= text_field :user, :email %></p>
<% @user.guesses.each_with_index do |guess, index| %>
<% fields_for "guesses[#{index}]", guess do |f| %>
<%= f.hidden_field :phrase_id %>
<p>
<%= guess.phrase.description %>
<%= f.text_field :content %>
</p>
<% end %>
<% end %>
<%= end_form_tag %>
If this code is generating an error as you mentioned before, let me know what the error is and I may be able to help.
Saving the submission to the database is the same as I mentioned before:
ef create
@user = User.new(params[:user])
params[:guesses].each_value { |guess| @user.guesses.build(guess) }
if @user.save
redirect_to :action => 'index'
else
render :action => 'new'
end
end
Hope that works for you. Sorry I haven't been much help so far on this.
Railscasts - Free Ruby on Rails Screencasts