aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/ship.rb
diff options
context:
space:
mode:
authorIan White <ian.w.white@gmail.com>2010-05-18 10:28:26 +0100
committerJosé Valim <jose.valim@gmail.com>2010-05-18 16:13:00 +0200
commitb439d85a19c02eefab1ee308fff334ac1049524d (patch)
tree75fa2fa34a6d8ac398d25755d0b84de416500d5c /activerecord/test/models/ship.rb
parentce20b93606195eff1ea2dfeb2aa311130dd9977e (diff)
downloadrails-b439d85a19c02eefab1ee308fff334ac1049524d.tar.gz
rails-b439d85a19c02eefab1ee308fff334ac1049524d.tar.bz2
rails-b439d85a19c02eefab1ee308fff334ac1049524d.zip
Nested records (re: autosave) are now updated even when the intermediate parent record is unchanged [#4242 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/test/models/ship.rb')
-rw-r--r--activerecord/test/models/ship.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/models/ship.rb b/activerecord/test/models/ship.rb
index 75c792d176..3da031946f 100644
--- a/activerecord/test/models/ship.rb
+++ b/activerecord/test/models/ship.rb
@@ -3,8 +3,9 @@ class Ship < ActiveRecord::Base
belongs_to :pirate
belongs_to :update_only_pirate, :class_name => 'Pirate'
- has_many :parts, :class_name => 'ShipPart', :autosave => true
+ has_many :parts, :class_name => 'ShipPart'
+ accepts_nested_attributes_for :parts, :allow_destroy => true
accepts_nested_attributes_for :pirate, :allow_destroy => true, :reject_if => proc { |attributes| attributes.empty? }
accepts_nested_attributes_for :update_only_pirate, :update_only => true