Rails Nested Model Form
===

At the moment I have three models:

    Songs have many Setlists through Allocations
    Setlists have many Songs through Allocations
    Allocations belong to Setlists and belong to Songs

My form at the moment looks like:

 <%=form_for(@setlist) do|f|%>
 
     <%=f.label :date, "Set a date" %>
     <%=f.date_select :date%>

     <div>
      <%= render 'song' %> 
     </div>
     
     <%=f.submit "Create Setlist", class: "btn btn-large btn-primary" %>
  <% end %>

the song partial given above is:

    <div id="songSelection">
    <table class= "table table-striped table-bordered">
    	  	<thead>
    	  		<th>Title</th>
    	  		<th>Artist</th>
    	  		<th>Add to Set</th>
    	  	</thead>
    	  	<tbody>
    	  	  <% @songs.each do |song| %>
                <tr>
                   <td><%= song.title %></td>
                   <td><%= song.artist %></td>
                   <td>
                   	<%= f.fields_for(@setlist.allocations.build(song_id: song.id)) do |builder| %>
                   	  <%= builder.submit "Add Song", class: "btn btn-small btn-primary" %>
                   	<% end %>
                   </td>
                </tr>
              <% end %>
    	    </tbody>
    </table>
    </div>

Basically I'm trying to assign songs to setlists through allocations. At the moment it states that the f in the songs partial isn't defined. If I get rid of it then the page renders fine but doesn't function properly (i.e. whenever I click the button to add a song it redirects it saves the changes to the setlist date but doesn't assign any new allocations). Any help would be much appreciated. I realize that I may have missed out information as I'm somewhat new to this so if any additional details are needed please ask. 
