mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fixed duplicating ActiveModel::Errors#details
This commit is contained in:
parent
847395a04d
commit
fb7d95b212
2 changed files with 3 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
require 'active_support/core_ext/array/conversions'
|
||||
require 'active_support/core_ext/string/inflections'
|
||||
require 'active_support/core_ext/object/deep_dup'
|
||||
|
||||
module ActiveModel
|
||||
# == Active \Model \Errors
|
||||
|
@ -77,7 +78,7 @@ module ActiveModel
|
|||
|
||||
def initialize_dup(other) # :nodoc:
|
||||
@messages = other.messages.dup
|
||||
@details = other.details.dup
|
||||
@details = other.details.deep_dup
|
||||
super
|
||||
end
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ class ErrorsTest < ActiveModel::TestCase
|
|||
errors.add(:name, :invalid)
|
||||
errors_dup = errors.dup
|
||||
errors_dup.add(:name, :taken)
|
||||
assert_not_same errors_dup.details, errors.details
|
||||
assert_not_equal errors_dup.details, errors.details
|
||||
end
|
||||
|
||||
test "delete removes details on given attribute" do
|
||||
|
|
Loading…
Reference in a new issue