renew deprecated methods (#1444)
* renew deprecated methods * replace "attribute_names" with the methods that exist in the Rails 5.2 and 6.0 APIs
This commit is contained in:
parent
b3c792338a
commit
7663821cff
|
@ -8,7 +8,7 @@ module Shoulda
|
|||
end
|
||||
|
||||
def format_validation_errors(errors)
|
||||
list_items = errors.keys.map do |attribute|
|
||||
list_items = errors.to_hash.keys.map do |attribute|
|
||||
messages = errors[attribute]
|
||||
"* #{attribute}: #{messages}"
|
||||
end
|
||||
|
|
|
@ -73,7 +73,7 @@ describe Shoulda::Matchers::ActiveModel::DisallowValueMatcher, type: :model do
|
|||
|
||||
def custom_validation # rubocop:disable Lint/NestedMethodDefinition
|
||||
if self[:attr] != 'good value'
|
||||
errors[:attr2] << 'some message'
|
||||
errors.add :attr2, 'some message'
|
||||
end
|
||||
end
|
||||
end.new
|
||||
|
|
Loading…
Reference in New Issue