norman / ambry

Ambry is a database and ORM replacement for (mostly) static models and small datasets. It provides ActiveModel compatibility, and flexible searching and storage.
http://rubydoc.info/github/norman/ambry/master/frames
MIT License
57 stars 3 forks source link

♻️ Change ActiveModel::Errors[]#<< to ActiveModel::Errors#add #19

Open Lomig opened 3 years ago

Lomig commented 3 years ago

Purpose

The purpose of this pull request is to fix the following warning message:

DEPRECATION WARNING: Calling `<<` to an ActiveModel::Errors message array in order to add an error is deprecated. Please call `ActiveModel::Errors#add` instead

ActiveModel Errors are full fledged objects starting with Rails 6.1

Backward compatibility

I introduced a conditional to ensure backward compatibility