views:

30

answers:

1

I have a subject model with two fields - "name" and "level". I want to be able to visit "/subjects#new" and add 10 subjects objects at once. How can I do this in formtastic.

In regular forms I would do this:

<% @subjects.each do |s| %> 
   <% fields_for "subject[#{s.id}]", s do |f|%>                                                                  
     <%= f.name%>
     <%= f.level %>
   <% end %> 
<% end %>   
+1  A: 

Change fields_for to semantic_fields_for for and it should work.

Maran
Thanks.... worked a charm. I feel like a bit of a dumbass when the solution was so simple!
Jack Kinsella