Rails 6.1’s ActiveModel Errors Revamp
18-Jun-2020 1818
When our model object contains invalid data, the valid? call would fill up the errors information. Historically this behaved like a hash which maps attribute to error messages. However at Rails 5.0, a separate details hash was added for accessing additional information.The two hashes are supposed to be a one-to-one mapping, but finding one message’s corresponding details is actually a chore. You need to get the index of the message, then use that to access the second hash.
Rails 6.1’s ActiveModel Errors Revamp #ruby #rubydeveloper #rubyonrails #Rails #6.1’s #ActiveModel #Errors #Revamp #activemodel #errors https://rubyonrails.ba/link/rails-6-1-s-activemodel-errors-revamp