RubyOnRails allows you to access attributes of objects associated with the main model, using one, deep hash. Use this tag if you have problem with a model in which you defined `accepts_nested_attributes_for` or if you use nested calls of `fields_for` in a view.
In RubyOnRails you can associate models using has_many, belongs_to or has_one. If you additionally use a macro accepts_nested_attributes_for you can edit these associated objects using a deep hash of attributes assigned to (or read from) the top-level object.
See example:
class User
  belongs_to :company
  accepts_nested_attributes_for :company
end
@user.attributes = {
  :name => "John User",
  :company_attributes => {
    :name => "ACME Ltd.",
  }
}
You can read more in:
- Nested Attributes and Nested Object Forms in Rails 2.3. Release Notes
- Short section Building Complex Forms in "Rails Form helpers" guide
- API documentation for accepts_nested_attributes_for
 
     
     
     
     
     
     
     
     
     
     
     
     
     
    