aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/tuning_peg.rb
diff options
context:
space:
mode:
authorEdouard CHIN <edouard.chin@shopify.com>2019-07-23 17:58:59 +0200
committerEdouard CHIN <edouard.chin@shopify.com>2019-07-23 17:58:59 +0200
commitff0204bc7f5b33a04cfe4f053e3f24a65f0faff5 (patch)
tree980451091d2f5bcda302c84ad4c76a1e1ffe9002 /activerecord/test/models/tuning_peg.rb
parent31105c81cc82ae829c382a4eee2c5aa362882dea (diff)
downloadrails-ff0204bc7f5b33a04cfe4f053e3f24a65f0faff5.tar.gz
rails-ff0204bc7f5b33a04cfe4f053e3f24a65f0faff5.tar.bz2
rails-ff0204bc7f5b33a04cfe4f053e3f24a65f0faff5.zip
Modify behaviour of `AM::Errors#to_h`:
- `AM::Error#to_h` was kind of broken before and would return in the hash values a single error message. ```ruby person = Person.new person.errors.add(:name, "cannot be blank") person.errors.add(:name, "too long") puts person.errors.to_h # {name: 'too long'} ``` Since an attribute can have different errors, the previous behavior didn't make much sense. Now, `ActiveModel::Errors#to_hash` correctly returns an array of error messages containing all the errors for an attribute. However, one can easily be surprised by this change, so let's deprecated it first.
Diffstat (limited to 'activerecord/test/models/tuning_peg.rb')
0 files changed, 0 insertions, 0 deletions