From f9ae1baa0ae47064d5100e48ffda1fe8b4fa34e7 Mon Sep 17 00:00:00 2001 From: Angelo Capilleri Date: Sat, 12 May 2012 15:03:21 +0200 Subject: clean the erros if an object that includes validations errors is duped. Fixes #5953 --- activemodel/lib/active_model/validations.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activemodel/lib') 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 -- cgit v1.2.3