Sha256: 4692f0427735653ae11c24350b78e341adb2dfef8482132389bf4451f614e469
Contents?: true
Size: 763 Bytes
Versions: 18
Compression:
Stored size: 763 Bytes
Contents
module Spree module DefaultPrice extend ActiveSupport::Concern included do has_one :default_price, -> { with_deleted.currently_valid.with_default_attributes }, class_name: 'Spree::Price', inverse_of: :variant, dependent: :destroy, autosave: true end def find_or_build_default_price default_price || build_default_price(Spree::Config.default_pricing_options.desired_attributes) end delegate :display_price, :display_amount, :price, :currency, to: :find_or_build_default_price delegate :price=, :currency=, to: :find_or_build_default_price deprecate :currency=, :currency, deprecator: Spree::Deprecation def has_default_price? !default_price.nil? end end end
Version data entries
18 entries across 18 versions & 1 rubygems