Sha256: 64ba0b53d9da4e8b33124f6718aef4c869549611d5568cb93f34baa255933c73
Contents?: true
Size: 802 Bytes
Versions: 2
Compression:
Stored size: 802 Bytes
Contents
module Spree class ShippingRate < ActiveRecord::Base belongs_to :shipment, class_name: 'Spree::Shipment' belongs_to :shipping_method, class_name: 'Spree::ShippingMethod', inverse_of: :shipping_rates scope :with_shipping_method, -> { includes(:shipping_method). references(:shipping_method). order("cost ASC") } delegate :order, :currency, to: :shipment delegate :name, to: :shipping_method def display_price if Spree::Config[:shipment_inc_vat] price = (1 + Spree::TaxRate.default) * cost else price = cost end Spree::Money.new(price, { currency: currency }) end alias_method :display_cost, :display_price def shipping_method Spree::ShippingMethod.unscoped { super } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree_core-2.1.5 | app/models/spree/shipping_rate.rb |
spree_core-2.1.4 | app/models/spree/shipping_rate.rb |