I've looked at all the tutorials on how to create multiple objects of the same type with one form. However, I cannot get it to work with my REST app. This is what I have tried:
----- Controller ---------
'new' action ---------- def new @students = 5.times { @students << Student.new } end
'create' action ---------- params[:students].values do |student| Student.new(student) unless student.values.all?(&:blank?) end
-------- View ----------- <% @students.each_with_index do |student, index| %> <% fields_for "students[#{index}]", student do |s| %> <%= render :partial => 'students/student_form', :locals => {:f => s} %> <% end %> <% end %>
I cannot figure out why this is not working. The objects will not get saved. Please help.