Closed skunkworker closed 2 years ago
DEPRECATION WARNING: Calling `<<` to an ActiveModel::Errors message array in order to add an error is deprecated. Please call `ActiveModel::Errors#add` instead.
https://api.rubyonrails.org/v6.1.3/classes/ActiveModel/Errors.html#method-i-add
My stab at this (only for rails 6.1) is here: https://github.com/liveh2o/active_remote/pull/86
I would prefer to find a solution that doesn't rely so much on private methods and logic, personally.
My stab at this (only for rails 6.1) is here: #86
I would prefer to find a solution that doesn't rely so much on private methods and logic, personally.
Well all it's doing is @attributes.write_from_user(attr_name, value)
But #86 is missing the error changes
Well all it's doing is
@attributes.write_from_user(attr_name, value)
But #86 is missing the error changes
Tests pass for 6.1 without those changes. I think updating incrementally is usually a good idea so that's what I was trying to do. Could always extract the changes for Rails 7 into a different PR.
Sounds like we're ready to release this change to add rails 7 support? I know people are asking about it.
Sounds like we're ready to release this change to add rails 7 support? I know people are asking about it.
I'll come back around to this soon and review it.
@WriterZephos I pulled in your changes into this branch from https://github.com/liveh2o/active_remote/pull/86
It looks like (at least in Rails 7) that attributes need to be called with strings and not keys. Also calling
subject.errors[:base] << "Boom!"
looks like it's deprecated in favor ofsubject.errors.add(:base, :foo, message: "Boom!")