mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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 ca8c21df0f
.
This commit is contained in:
parent
219402901f
commit
b8e9dc489b
2 changed files with 0 additions and 12 deletions
|
@ -36,10 +36,6 @@ module ActiveRecord
|
|||
merge! association.scope(nullify: false)
|
||||
end
|
||||
|
||||
def initialize_dup(other) # :nodoc:
|
||||
@association = @association.deep_dup
|
||||
end
|
||||
|
||||
def target
|
||||
@association.target
|
||||
end
|
||||
|
|
|
@ -2056,14 +2056,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
|
||||
|
|
Loading…
Reference in a new issue