diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-05-15 12:53:01 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-05-15 12:53:01 -0700 |
commit | 8470fdb734552d9c3799521cd533330dd6962a98 (patch) | |
tree | f3c88440c0f0e1eb86e39843548def6b12c101a3 | |
parent | 2dfa8b5995d4f50df6f0080d4df634679cc44e30 (diff) | |
parent | e885b18fe9d20746fd0e5165815119bd2836cd60 (diff) | |
download | rails-8470fdb734552d9c3799521cd533330dd6962a98.tar.gz rails-8470fdb734552d9c3799521cd533330dd6962a98.tar.bz2 rails-8470fdb734552d9c3799521cd533330dd6962a98.zip |
Merge pull request #6329 from acapilleri/backport_dup_validation_3_2
Backport dup validation 3 2
-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. |