diff options
author | Vokhmin Alexey V <avokhmin@gmail.com> | 2015-12-03 21:18:57 +0300 |
---|---|---|
committer | Vokhmin Alexey V <avokhmin@gmail.com> | 2015-12-14 19:02:20 +0300 |
commit | 61e50814040d68c640b16afd2b9c419d2f12fad6 (patch) | |
tree | ac4d6a8ec0694b968670fc5d872a6b258f0410b3 /activemodel/lib | |
parent | 574f255629a45cd67babcfb9bb8e163e091a53b8 (diff) | |
download | rails-61e50814040d68c640b16afd2b9c419d2f12fad6.tar.gz rails-61e50814040d68c640b16afd2b9c419d2f12fad6.tar.bz2 rails-61e50814040d68c640b16afd2b9c419d2f12fad6.zip |
`ActiveRecord::Base#becomes` should copy the errors
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 4726a68f69..ef6141a51d 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -81,6 +81,18 @@ module ActiveModel super end + # Copies the errors from <tt>other</tt>. + # + # other - The ActiveModel::Errors instance. + # + # Examples + # + # person.errors.copy!(other) + def copy!(other) # :nodoc: + @messages = other.messages.dup + @details = other.details.dup + end + # Clear the error messages. # # person.errors.full_messages # => ["name cannot be nil"] |