This is probably a simple question. I'm reading the form helpers guide on rubyonrails.org ( http://guides.rubyonrails.org/form_helpers.html ). In section 7.3 it shows how to make a form that returns a hash of params like the following:
{'person' => {'name' => 'Bob', 'address' => {'23' => {'city' => 'Paris'}, '45' => {'city' => 'London'}}}}
Bob has 2 addresses in the hash. So what goes in the controller in order to update both addresses for Bob at the same time?
Thanks.
Update:
Here's what I assume the models would look like, but I still don't know what the controller should look like to update both of Bob's addresses simultaneously.
person.rb
attr_accessible :name, :addresses_attributes
has_many :addresses
accepts_nested_attributes_for :addresses
address.rb
attr_accessible :city
belongs_to :person
Thank you.