diff options
author | Eloy Duran <eloy.de.enige@gmail.com> | 2009-02-01 14:44:30 +1300 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-02-01 14:44:30 +1300 |
commit | ec8f04584479aff895b0b511a7ba1e9d33f84067 (patch) | |
tree | 86d6580345865cd1ce63b2055c0eca091ba8ee52 /activerecord/test/models/pirate.rb | |
parent | a02d752ae408b34e048b7b040e28c36074a9119f (diff) | |
download | rails-ec8f04584479aff895b0b511a7ba1e9d33f84067.tar.gz rails-ec8f04584479aff895b0b511a7ba1e9d33f84067.tar.bz2 rails-ec8f04584479aff895b0b511a7ba1e9d33f84067.zip |
Add support for nested object forms to ActiveRecord and the helpers in ActionPack
Signed-Off-By: Michael Koziarski <michael@koziarski.com>
[#1202 state:committed]
Diffstat (limited to 'activerecord/test/models/pirate.rb')
-rw-r--r-- | activerecord/test/models/pirate.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/models/pirate.rb b/activerecord/test/models/pirate.rb index 51c8183dee..6a2416a05c 100644 --- a/activerecord/test/models/pirate.rb +++ b/activerecord/test/models/pirate.rb @@ -5,5 +5,12 @@ class Pirate < ActiveRecord::Base has_many :treasure_estimates, :through => :treasures, :source => :price_estimates + # These both have :autosave enabled because accepts_nested_attributes_for is used on them. + has_one :ship + 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 + validates_presence_of :catchphrase end |