Class: Effective::CartItem
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::CartItem
- Defined in:
- app/models/effective/cart_item.rb
Instance Method Summary collapse
- #price ⇒ Object
- #subtotal ⇒ Object (also: #total)
- #tax_exempt ⇒ Object
- #title ⇒ Object
Instance Method Details
#price ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/models/effective/cart_item.rb', line 19 def price if (purchasable.price || 0).kind_of?(Integer) purchasable.price || 0 else ActiveSupport::Deprecation.warn('price is a non-integer. It should be an Integer representing the number of cents. Continuing with (price * 100.0).round(0).to_i conversion') unless EffectiveOrders.silence_deprecation_warnings (purchasable.price * 100.0).round(0).to_i rescue 0 end end |
#subtotal ⇒ Object Also known as: total
36 37 38 |
# File 'app/models/effective/cart_item.rb', line 36 def subtotal price * quantity end |
#tax_exempt ⇒ Object
32 33 34 |
# File 'app/models/effective/cart_item.rb', line 32 def tax_exempt purchasable.try(:tax_exempt) || false end |
#title ⇒ Object
28 29 30 |
# File 'app/models/effective/cart_item.rb', line 28 def title purchasable.try(:title) || 'New Cart Item' end |