aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model
diff options
context:
space:
mode:
authorAngelo Capilleri <resca_air@MacBook-Air-di-angelo-giovanni-capilleri.local>2012-05-12 15:03:21 +0200
committerAngelo Capilleri <resca_air@MacBook-Air-di-angelo-giovanni-capilleri.local>2012-05-13 23:24:05 +0200
commitf9ae1baa0ae47064d5100e48ffda1fe8b4fa34e7 (patch)
tree2c22b7a9ea42cf025b8c27793a9d1e70865f024d /activemodel/lib/active_model
parent98355fe100d9e014e88ba9b1b78f606c9312bc44 (diff)
downloadrails-f9ae1baa0ae47064d5100e48ffda1fe8b4fa34e7.tar.gz
rails-f9ae1baa0ae47064d5100e48ffda1fe8b4fa34e7.tar.bz2
rails-f9ae1baa0ae47064d5100e48ffda1fe8b4fa34e7.zip
clean the erros if an object that includes validations errors is duped. Fixes #5953
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r--activemodel/lib/active_model/validations.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb
index 3ed72bae3b..72176e9bdd 100644
--- a/activemodel/lib/active_model/validations.rb
+++ b/activemodel/lib/active_model/validations.rb
@@ -177,6 +177,12 @@ module ActiveModel
super
end
end
+
+ # Clean the +Errors+ object if instance is duped
+ def initialize_dup(other) # :nodoc:
+ @errors = nil
+ super
+ end
# Returns the +Errors+ object that holds all information about attribute error messages.
def errors