From 396e383286ccc368b54e980e06a506d339843594 Mon Sep 17 00:00:00 2001 From: Angelo capilleri Date: Tue, 15 May 2012 18:16:28 +0200 Subject: clean the errors if an object that includes validations errors is duped,for 3-2-stable It Fixes #5953 in 3-2-stable, it's the same pull request of #6284 --- activemodel/lib/active_model/validations.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activemodel/lib/active_model') diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index 8ed392abca..1d39f2357f 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -165,6 +165,12 @@ module ActiveModel 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 @errors ||= Errors.new(self) -- cgit v1.2.3