diff options
author | Lance Ivy <lance@cainlevy.net> | 2009-02-08 14:23:35 +0100 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-02-13 21:47:56 +1300 |
commit | 5dbc9d40a49f5f0f50c2f3ebe6dda942f0e61562 (patch) | |
tree | 90f4a5d54190ada928712a285c56bcfe6da334fc /activerecord/test/models | |
parent | a6508527570cd3f7225a7030218447bcc5824224 (diff) | |
download | rails-5dbc9d40a49f5f0f50c2f3ebe6dda942f0e61562.tar.gz rails-5dbc9d40a49f5f0f50c2f3ebe6dda942f0e61562.tar.bz2 rails-5dbc9d40a49f5f0f50c2f3ebe6dda942f0e61562.zip |
Changed API of NestedAttributes to take an array, or hash with index keys, of hashes that have the id on the inside of the attributes hash and updated the FormBuilder to produce such hashes. Also fixed NestedAttributes with composite ids.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
[#1892 state:committed]
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/pirate.rb | 2 | ||||
-rw-r--r-- | activerecord/test/models/ship.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/test/models/pirate.rb b/activerecord/test/models/pirate.rb index 6a2416a05c..7bc50e0e7b 100644 --- a/activerecord/test/models/pirate.rb +++ b/activerecord/test/models/pirate.rb @@ -10,7 +10,7 @@ class Pirate < ActiveRecord::Base has_many :birds accepts_nested_attributes_for :parrots, :birds, :allow_destroy => true, :reject_if => proc { |attributes| attributes.empty? } - accepts_nested_attributes_for :ship, :allow_destroy => true + accepts_nested_attributes_for :ship, :allow_destroy => true, :reject_if => proc { |attributes| attributes.empty? } validates_presence_of :catchphrase end diff --git a/activerecord/test/models/ship.rb b/activerecord/test/models/ship.rb index c46e27f3ae..06759d64b8 100644 --- a/activerecord/test/models/ship.rb +++ b/activerecord/test/models/ship.rb @@ -4,7 +4,7 @@ class Ship < ActiveRecord::Base belongs_to :pirate has_many :parts, :class_name => 'ShipPart', :autosave => true - accepts_nested_attributes_for :pirate, :allow_destroy => true + accepts_nested_attributes_for :pirate, :allow_destroy => true, :reject_if => proc { |attributes| attributes.empty? } validates_presence_of :name -end
\ No newline at end of file +end |