Skip to content
Snippets Groups Projects
Commit d8c66f44 authored by Igor Drozdov's avatar Igor Drozdov :two:
Browse files

Handle Rails 6.1 ActiveModel::Errors changes

Modal errors as objects are introduced:
https://github.com/rails/rails/pull/32313

model.errors.first returns ActiveModel::Error object
that's why model.errors.first[1] doesn't work in Rails 6.1

We need a way that works both for 6.1 and 6.0 in order to
introduce changes gradually:

model.errors.values.first works for both versions.

Even though treating errors as a hash is deprecated it works
so we can introduce the changes in 6.0 and then fix the
deprecations when we're on 6.1

(cherry picked from commit b5ecc309)
parent 2376a5ee
No related branches found
No related tags found
1 merge request!59861Handle Rails 6.1 ActiveModel::Errors changes
Showing
with 37 additions and 27 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment