Skip to content

Commit

Permalink
Improve deprecation message for 'deprecated_method_type_override'
Browse files Browse the repository at this point in the history
Previously stack trace line that the deprecation message would print was
the `#partial_name` method inside PaymentMethod itself, which isn't very
helpful.

Also, print out corresponding class name.
  • Loading branch information
jordan-brough committed Jan 9, 2018
1 parent fb8c724 commit 4b6ec70
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/app/models/spree/payment_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def partial_name
# If method_type has been overridden, call it and return the value, otherwise return nil
def deprecated_method_type_override
if method(:method_type).owner != Spree::PaymentMethod
Spree::Deprecation.warn "overriding PaymentMethod#method_type is deprecated and will be removed from Solidus 3.0 (override partial_name instead)", caller
Spree::Deprecation.warn "#{method(:method_type).owner} is overriding PaymentMethod#method_type. This is deprecated and will be removed from Solidus 3.0 (override partial_name instead).", caller[1..-1]
method_type
end
end
Expand Down

0 comments on commit 4b6ec70

Please sign in to comment.