Class: Effective::CartItem
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::CartItem
- Defined in:
- app/models/effective/cart_item.rb
Instance Method Summary collapse
Instance Method Details
#price ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/models/effective/cart_item.rb', line 15 def price if (purchasable.price || 0).kind_of?(Integer) purchasable.price || 0 else raise 'expected price to be an Integer representing the number of cents.' end end |
#subtotal ⇒ Object
31 32 33 |
# File 'app/models/effective/cart_item.rb', line 31 def subtotal price * quantity end |
#tax_exempt ⇒ Object
27 28 29 |
# File 'app/models/effective/cart_item.rb', line 27 def tax_exempt purchasable.try(:tax_exempt) || false end |
#title ⇒ Object
23 24 25 |
# File 'app/models/effective/cart_item.rb', line 23 def title purchasable.try(:title) || 'New Cart Item' end |