Permalink
Browse files

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 ca8c21d.
  • Loading branch information...
eileencodes committed Feb 28, 2017
1 parent 2840c42 commit a00abc150b35659165c12d135b373278e1b313a8
@@ -33,10 +33,6 @@ def initialize(klass, association) #:nodoc:
super klass, klass.arel_table, klass.predicate_builder
end
- def initialize_dup(other) # :nodoc:
- @association = @association.deep_dup
- end
-
def target
@association.target
end
@@ -2107,14 +2107,6 @@ def test_to_a_should_dup_target
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

0 comments on commit a00abc1

Please sign in to comment.