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
22 23 24 |
# File 'app/models/effective/cart_item.rb', line 22 def name purchasable&.purchasable_name end |
#price ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/models/effective/cart_item.rb', line 26 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
38 39 40 |
# File 'app/models/effective/cart_item.rb', line 38 def subtotal price * quantity end |
#tax_exempt ⇒ Object
34 35 36 |
# File 'app/models/effective/cart_item.rb', line 34 def tax_exempt purchasable&.tax_exempt || false end |
#to_s ⇒ Object
18 19 20 |
# File 'app/models/effective/cart_item.rb', line 18 def to_s name || 'New Cart Item' end |