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
#name ⇒ Object
19 20 21 |
# File 'app/models/effective/cart_item.rb', line 19 def name purchasable&.purchasable_name end |
#price ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/models/effective/cart_item.rb', line 23 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
35 36 37 |
# File 'app/models/effective/cart_item.rb', line 35 def subtotal price * quantity end |
#tax_exempt ⇒ Object
31 32 33 |
# File 'app/models/effective/cart_item.rb', line 31 def tax_exempt purchasable&.tax_exempt || false end |
#to_s ⇒ Object
15 16 17 |
# File 'app/models/effective/cart_item.rb', line 15 def to_s name || 'New Cart Item' end |