aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorAngelo Capilleri <resca_air@MacBook-Air-di-angelo-giovanni-capilleri.local>2012-05-15 21:32:10 +0200
committerAngelo Capilleri <resca_air@MacBook-Air-di-angelo-giovanni-capilleri.local>2012-05-15 21:32:10 +0200
commite885b18fe9d20746fd0e5165815119bd2836cd60 (patch)
treef3c88440c0f0e1eb86e39843548def6b12c101a3 /activemodel/lib
parent2dfa8b5995d4f50df6f0080d4df634679cc44e30 (diff)
downloadrails-e885b18fe9d20746fd0e5165815119bd2836cd60.tar.gz
rails-e885b18fe9d20746fd0e5165815119bd2836cd60.tar.bz2
rails-e885b18fe9d20746fd0e5165815119bd2836cd60.zip
add backport for the pull request #6324
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/validations.rb10
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.