diff --git a/core/app/models/spree/shipment.rb b/core/app/models/spree/shipment.rb index e47bd05e8a9..8775c3282f6 100644 --- a/core/app/models/spree/shipment.rb +++ b/core/app/models/spree/shipment.rb @@ -7,7 +7,7 @@ class Shipment < Spree::Base has_many :adjustments, as: :adjustable, inverse_of: :adjustable, dependent: :delete_all has_many :inventory_units, dependent: :destroy, inverse_of: :shipment - has_many :shipping_rates, -> { order(:cost) }, dependent: :destroy + has_many :shipping_rates, -> { order(:cost) }, dependent: :destroy, inverse_of: :shipment has_many :shipping_methods, through: :shipping_rates has_many :state_changes, as: :stateful has_many :cartons, -> { uniq }, through: :inventory_units diff --git a/core/app/models/spree/shipping_rate.rb b/core/app/models/spree/shipping_rate.rb index 623ac07053f..2f8bac3f631 100644 --- a/core/app/models/spree/shipping_rate.rb +++ b/core/app/models/spree/shipping_rate.rb @@ -9,6 +9,7 @@ class ShippingRate < Spree::Base has_many :taxes, class_name: "Spree::ShippingRateTax", foreign_key: "shipping_rate_id", + inverse_of: :shipping_rate, dependent: :destroy delegate :order, :currency, to: :shipment @@ -26,7 +27,7 @@ class ShippingRate < Spree::Base def display_price price = display_amount.to_s - return price if taxes.empty? || amount == 0 + return price if taxes.to_a.empty? || amount == 0 tax_explanations = taxes.map(&:label).join(tax_label_separator)