cainlevy
2009-Feb-06  05:41 UTC
Patch Review Request: #1892 moves ids inside the nested attributes hash
==The Problem:
The parameter structure in the current implementation of nested attributes
does support both modification and replacement of existing has_one records.
==The Solution:
Move ids inside the hash. That is, instead of:
  @pirate.birds_attributes = {
    ''12'' => { :name => ''Polly'' },
    ''new_1'' => { :name => ''Wally'' }
  }
we have:
  @pirate.birds_attributes = {
    ''0'' => { :id => ''12'', :name =>
''Polly'' },
    ''1'' => { :name => ''Wally'' }
  }
which naturally extends to has_one associations to allow both modification:
  @pirate.ship_attributes = { :id => ''5'', :name =>
''Bessy'' }
and replacement:
  @pirate.ship_attributes = { :name => ''Henry'' }
==The Patch:
http://rails.lighthouseapp.com/projects/8994/tickets/1892-nested-attributes-should-not-have-meaningful-hash-keys
-Lance
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---