title: One Submit button with multiple forms
body: <p>I'm trying to create a scoring App. Since I'm new to StackOverflow I can't upload the screen shots but here are screen shot links </p>
  
  <ol>
  <li><a href="http://www.flickr.com/photos/crashhog/5553530942/" rel="nofollow">Now it looks like this</a>.</li>
  <li><a href="http://www.flickr.com/photos/crashhog/5552946323/in/photostream/" rel="nofollow">This is what I want it to be</a>.</li>
  <li>Here are the models involve in the view. Just click the next picture = the last picture in the Photostream (again StackOverflow won't allow me to post more than 3 hyperlinks). </li>
  </ol>
  
  <p>This view above is from: localhost/matchdays/4/matches/new</p>
  
  <p>The relationship would look like this:</p>
  
  <ol>
  <li>A Matchday has_many matches.</li>
  <li>A Match has_many games (maximum of 3, but for now we'll stick with 1). We will update the score attribute.</li>
  <li>A Game has_many pairs (maximum 2).</li>
  </ol>
  
  <p>My question is:</p>
  
  <ol>
  <li><p>How do you code in the MatchesController (when the user hit Start) to create a game with 2 pairs and each pair has its own score (which is an attribute in the Game model)?</p></li>
  <li><p>How do you loop in the view to add another Game(Score attribute) and Pair form that belongs to the Match (in this case Match 10)? Just like in the screen shot 2 above. </p></li>
  </ol>
  
  <p>Matches Controller:</p>
  
  <pre><code>  def new
      @matchday = Matchday.last
      @match = Match.new()
      @match.number = match_numbering
      @pairs = Pair.all
      @matchday.best_of.times { @match.games.build }
    end
  
    def create
      @match = Match.new(params[:match])
      @matchday = Matchday.last
      @match.number = match_numbering
      if @match.save
        @matchday.matches &lt;&lt; @match
        flash[:success] = "Match recorded"
        redirect_to matchdays_path
      else
        @title = "Record Match"
        render 'new'
      end    
    end 
  </code></pre>
  
  <p>/views/matches/new:</p>
  
  <pre><code>&lt;h1&gt;Match &lt;%= @match.number %&gt; of Matchday &lt;%= @matchday.number %&gt; details&lt;/h1&gt;
  
  &lt;%= form_for @match, :url =&gt; {:action =&gt; 'create', :id =&gt; @match.id } do |p| %&gt;
      &lt;%= render 'shared/error_messages', :object =&gt; p.object %&gt;
  
      &lt;%= render :partial =&gt; 'match_form', :locals =&gt; {:p =&gt; p} %&gt;
  
      &lt;% for game in @match.games %&gt;
          &lt;%= fields_for :games, game do |game_form| %&gt;
              &lt;p&gt;
                  Score: &lt;%= game_form.text_field :score, :size =&gt; 2 %&gt;               
              &lt;/p&gt;
              &lt;p&gt;
                  Pair: &lt;%= select(@pairs, :pair_id,Pair.all.collect{|p| [p.name]}) %&gt;
              &lt;/p&gt;
          &lt;% end %&gt;
      &lt;% end %&gt;
  
      &lt;div class = "action_links"&gt;
          &lt;p&gt; &lt;%= link_to "Cancel", matchdays_path, :class =&gt; "cancel" %&gt; | 
              &lt;%= p.submit "Start" %&gt;&lt;/p&gt;
      &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>I think the looping must be put some where in the for loop, but not sure how to implement it. Plus my fields_for and select form might might not be correct... much to learn :)</p>