aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2017-02-28 13:45:01 -0500
committereileencodes <eileencodes@gmail.com>2017-02-28 13:45:01 -0500
commita00abc150b35659165c12d135b373278e1b313a8 (patch)
tree2fdb305bee14e5eaac60beb4c50e06c28acc0ba0 /activerecord
parent2840c429cc1cf0edb6e6549f7581b782021a71f9 (diff)
downloadrails-a00abc150b35659165c12d135b373278e1b313a8.tar.gz
rails-a00abc150b35659165c12d135b373278e1b313a8.tar.bz2
rails-a00abc150b35659165c12d135b373278e1b313a8.zip
Revert "Dupping a CollectionProxy should dup the load_target"
I incorrectly changed behavior of `dup`. Reading the original issue I thought that `dup` should retain the original contents of the record and it's associations but it is in fact supposed to be a copy as if a record had been reinitialized. This reverts commit ca8c21df0fdbf1f03ba2f7fb16b39c3282dc1be0.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/collection_proxy.rb4
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb8
2 files changed, 0 insertions, 12 deletions
diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb
index d35fe9fe50..55bf2e0ff0 100644
--- a/activerecord/lib/active_record/associations/collection_proxy.rb
+++ b/activerecord/lib/active_record/associations/collection_proxy.rb
@@ -33,10 +33,6 @@ module ActiveRecord
super klass, klass.arel_table, klass.predicate_builder
end
- def initialize_dup(other) # :nodoc:
- @association = @association.deep_dup
- end
-
def target
@association.target
end
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index 3ef322d9e5..ede3a44090 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -2107,14 +2107,6 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert_not_equal target.object_id, ary.object_id
end
- def test_dup_should_dup_load_target
- original = topics(:first).replies
- dupped = topics(:first).replies.dup
-
- assert_not_equal original.object_id, dupped.object_id
- assert_not_equal original.load_target.object_id, dupped.load_target.object_id
- end
-
def test_merging_with_custom_attribute_writer
bulb = Bulb.new(color: "red")
assert_equal "RED!", bulb.color