Class: Spree::Price

Inherits:
Base
  • Object
show all
Extended by:
DisplayMoney
Defined in:
app/models/spree/price.rb

Instance Method Summary collapse

Methods included from DisplayMoney

money_methods

Methods inherited from Base

page

Methods included from Spree::Preferences::Preferable

#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Instance Method Details

#moneyObject



13
14
15
# File 'app/models/spree/price.rb', line 13

def money
  Spree::Money.new(amount || 0, { currency: currency })
end

#priceObject



17
18
19
# File 'app/models/spree/price.rb', line 17

def price
  amount
end

#price=(price) ⇒ Object



21
22
23
# File 'app/models/spree/price.rb', line 21

def price=(price)
  self[:amount] = Spree::LocalizedNumber.parse(price)
end

#variantObject

Remove variant default_scope ‘deleted_at: nil`



26
27
28
# File 'app/models/spree/price.rb', line 26

def variant
  Spree::Variant.unscoped { super }
end