aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@aura-online.co.uk>2010-06-30 23:22:13 +0100
committerJosé Valim <jose.valim@gmail.com>2010-07-01 01:06:58 +0200
commitf3fedd7f84c25d1d99a70af1e21e20abb48f100f (patch)
tree1d367c56060d05ca3fa4c867b37c59660a4b75fa /activerecord/lib/active_record/associations
parent57d750edf7c71e001ac314fa188aa1fc6292f8ab (diff)
downloadrails-f3fedd7f84c25d1d99a70af1e21e20abb48f100f.tar.gz
rails-f3fedd7f84c25d1d99a70af1e21e20abb48f100f.tar.bz2
rails-f3fedd7f84c25d1d99a70af1e21e20abb48f100f.zip
Don't remove scheduled destroys when loading an association. [#4642 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/association_collection.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb
index ddf4ce4058..a4e08c7d41 100644
--- a/activerecord/lib/active_record/associations/association_collection.rb
+++ b/activerecord/lib/active_record/associations/association_collection.rb
@@ -393,7 +393,12 @@ module ActiveRecord
@target = find_target.map do |f|
i = @target.index(f)
t = @target.delete_at(i) if i
- (t && t.changed?) ? t : f
+ if t && t.changed?
+ t
+ else
+ f.mark_for_destruction if t && t.marked_for_destruction?
+ f
+ end
end + @target
else
@target = find_target