diff options
author | Jahfer Husain <jahfer.husain@shopify.com> | 2017-07-07 13:16:06 -0400 |
---|---|---|
committer | Jahfer Husain <jahfer.husain@shopify.com> | 2017-07-07 14:32:59 -0400 |
commit | 3650ca983c5c2ffd1a2993fa091bf504594325a7 (patch) | |
tree | fa37bcac571b39046e4affd9d81fac7edda68d36 /activerecord/test/cases/binary_test.rb | |
parent | c9b514cd3e8fe7d74ae91ecd30db839132e7899c (diff) | |
download | rails-3650ca983c5c2ffd1a2993fa091bf504594325a7.tar.gz rails-3650ca983c5c2ffd1a2993fa091bf504594325a7.tar.bz2 rails-3650ca983c5c2ffd1a2993fa091bf504594325a7.zip |
Add ActiveModel::Errors#merge!
ActiveModel::Errors#merge! allows ActiveModel::Errors to append errors from
a separate ActiveModel::Errors instance onto their own.
Example:
person = Person.new
person.errors.add(:name, :blank)
errors = ActiveModel::Errors.new(Person.new)
errors.add(:name, :invalid)
person.errors.merge!(errors)
puts person.errors.messages
# => { name: ["can't be blank", "is invalid"] }
Diffstat (limited to 'activerecord/test/cases/binary_test.rb')
0 files changed, 0 insertions, 0 deletions