Yeah, that is not going to work. Have a look here: http://railscasts.com/episodes/165-edit-multiple
Darian Shimy -- http://www.darianshimy.com http://twitter.com/dshimy On Wed, Nov 18, 2009 at 10:41 PM, raji <dheer...@gmail.com> wrote: > Hi Guys, > > I'm having a little bit of trouble editing multiple model objects in a > single form. I've got a model Person with two attributes: name and > gender. For simplicity, gender can be a text input. > > I'd like to be able to display all Person objects (name and gender) in > a form. So, each model object gets its own row. > > In my controller, I fetch the objects with: > > @people = Person.find(:all) > > In my view, I loop through @people and render a form: > > <% for person in @people %> > <div> > <span><%= person.name %>:</span> > <span><%= text_field :person, :gender %></span> > </div> > <% end %> > > I've built plenty of forms that handle attributes from a single model > object. How would I edit multiple objects within a single form? In > specific, I'm not sure how to set the name attribute in the gender > field. And, i'm not sure how to deal with the params hash in my > controller to update the models. > > Thanks in advance, > Raj > > -- > > 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-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=. > > > -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=.