Class: Spree::Price

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

Instance Method Summary collapse

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

#display_amountObject Also known as: display_price



10
11
12
# File 'app/models/spree/price.rb', line 10

def display_amount
  money
end

#moneyObject



15
16
17
# File 'app/models/spree/price.rb', line 15

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

#priceObject



19
20
21
# File 'app/models/spree/price.rb', line 19

def price
  amount
end

#price=(price) ⇒ Object



23
24
25
# File 'app/models/spree/price.rb', line 23

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

#variantObject

Remove variant default_scope ‘deleted_at: nil`



28
29
30
# File 'app/models/spree/price.rb', line 28

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