Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Fix deprecation warning related to Rails 6.2
Browse files Browse the repository at this point in the history
> You are passing a block expecting two parameters,
> so the old hash behavior is simulated. As this is deprecated,
> this will result in an ArgumentError in Rails 6.2.
> DEPRECATION WARNING: Enumerating ActiveModel::Errors as a hash has been deprecated.
> In Rails 6.1, `errors` is an array of Error objects,
> therefore it should be accessed by a block with a single block
> parameter like this:
>
> person.errors.each do |error|
>   attribute = error.attribute
>   message = error.message
> end
  • Loading branch information
Flavio Auciello committed Apr 9, 2021
1 parent 56bae0f commit c198c5b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/solidus_paypal_braintree/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class Transaction
errors.add(:payment_method, 'Must be braintree')
end
if address && !address.valid?
address.errors.each do |field, error|
errors.add(:address, "#{field} #{error}")
address.errors.each do |error|
errors.add(:address, "#{error.attribute} #{error.message}")
end
end
end
Expand Down

0 comments on commit c198c5b

Please sign in to comment.