Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add backport for the pull request #6324

  • Loading branch information...
commit e885b18fe9d20746fd0e5165815119bd2836cd60 1 parent 2dfa8b5
Angelo Capilleri authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 activemodel/lib/active_model/validations.rb
View
10 activemodel/lib/active_model/validations.rb
@@ -168,7 +168,15 @@ def inherited(base)
# 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.
Please sign in to comment.
Something went wrong with that request. Please try again.