Deprecate ActiveModel::Errors add_on_empty and add_on_blank methods#18996
Conversation
|
I'm not sure if we should delete this test https://github.com/rails/rails/pull/18996/files#diff-399b5cddc709ef96edf30de2328934deR56 as it doesn't have any equivalent in regular validations and |
|
@morgoth let's remove that test when we remove the deprecated methods and keep it around for now. |
|
Even though we do not provide a direct replacement the deprecation message should give a hint where to look for similar behavior. It should be trivial to figure out what to change or where to look for more details. |
f5ce031 to
401b86f
Compare
|
@senny I added tip to use |
|
The thing is that |
|
What about "To achieve the same use validates_presence_of with :empty message"? |
|
If you have used /cc @rafaelfranca |
|
Yeah, it is more a kind of internal method to be used in custom validations. I think it is better to suggest people to write the actual code: errors.add(attribute, :empty, options) if value.nil? || value.empty? |
401b86f to
dbcfd70
Compare
|
@rafaelfranca I changed it to your suggestion |
dbcfd70 to
126b05c
Compare
There was a problem hiding this comment.
Same here but using blank?
…hods without replacement.
126b05c to
fd38838
Compare
|
done |
|
@morgoth thank you 💛 |
Deprecate `ActiveModel::Errors` `add_on_empty` and `add_on_blank` methods
This fixes a copy-and-paste-issue slipped in by rails#18996
Follow up to #18634 (comment)