diff options
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/validations.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index b48e910408..18cd53e130 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -168,7 +168,15 @@ module ActiveModel # Clean the +Errors+ object if instance is duped def initialize_dup(other) # :nodoc: @errors = nil - super + end + + # Backport dup from 1.9 so that #initialize_dup gets called + unless Object.respond_to?(:initialize_dup) + def dup # :nodoc: + copy = super + copy.initialize_dup(self) + copy + end end # Returns the +Errors+ object that holds all information about attribute error messages. |