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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Maybe I have to make a :collection => :post method? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Anyone else run into this problem? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m not an expert, but no one else seems to be helping. I''m familiar with 1.1.6 rails, just starting to use 1.2. In the ''old days'' in your create task, ''new'' would just create the object in memory, similar to your ''new'' task. ''Back then'' you had to either obj.save! or do obj.create instead of obj.new. Hope it helps you in some direction! On Mar 1, 9:00 pm, "jko170" <jko...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Anyone else run into this problem?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---