Skip to content

Commit

Permalink
alias_method fails picking up alias_attribute
Browse files Browse the repository at this point in the history
Fixing `alias_method': undefined method `amount' for class `Spree::ShippingRate' (NameError)

For now with just a method that returns the aliased attribute. We probably just want to use `cost` here though.
  • Loading branch information
peterberkenbosch committed Sep 1, 2023
1 parent f4ca068 commit 34188e3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/app/models/spree/shipping_rate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ class ShippingRate < Spree::Base
delegate :order, :currency, to: :shipment
delegate :name, :tax_category, :tax_category_id, to: :shipping_method
delegate :code, to: :shipping_method, prefix: true
alias_attribute :amount, :cost

alias_method :total_before_tax, :amount
alias_attribute :amount, :cost
def total_before_tax
amount
end

extend DisplayMoney
money_methods :amount
Expand Down

0 comments on commit 34188e3

Please sign in to comment.