[LRUG] Nested form params/active records

Frederik Fix frederikfix at eml.cc
Fri Feb 22 05:37:06 PST 2008


There were some Railscasts about this a while back. Have a look at:

Hope it helps,


On 22 Feb 2008, at 13:22, Joel Chippindale wrote:

> Given an ActiveRecord A, that belongs_to a B, I can create a single  
> form to edit all the attributes of these nested records in one go,  
> leading to a params hash with structure like:
> {"a" => {"an_attribute_of_a" => "x", "b" => { "an_attribute_of_b" =>  
> "y", "another_attribute_of_b" => "z" } }
> Then I would like to be able to write the following code, where a  
> (is an instance of A) that belongs to b (an instance of B)
> a.update_attributes(params[:a])
> and have it update the attributes of a AND also b which it belongs to.
> Before I go reinventing the wheel, does anyone know of an existing  
> plugin for ActiveRecord will enable this?
> J.
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org

More information about the Chat mailing list