Class: Spina::Shop::ProductItem
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Spina::Shop::ProductItem
- Defined in:
- app/models/spina/shop/product_item.rb
Instance Method Summary collapse
- #active? ⇒ Boolean
- #cache_everything ⇒ Object
- #description ⇒ Object
- #in_stock? ⇒ Boolean
- #inactive? ⇒ Boolean
-
#price_for_customer(customer) ⇒ Object
Get the price based on the one ordering.
- #product_images ⇒ Object
-
#short_description ⇒ Object
Short description is description and description is the Product’s name and ProductItem’s name combined.
- #weight ⇒ Object
Instance Method Details
#active? ⇒ Boolean
48 49 50 |
# File 'app/models/spina/shop/product_item.rb', line 48 def active? active? end |
#cache_everything ⇒ Object
56 57 58 |
# File 'app/models/spina/shop/product_item.rb', line 56 def cache_everything cache_averages end |
#description ⇒ Object
32 33 34 |
# File 'app/models/spina/shop/product_item.rb', line 32 def description [product.name, name].compact.join(', ') end |
#in_stock? ⇒ Boolean
44 45 46 |
# File 'app/models/spina/shop/product_item.rb', line 44 def in_stock? stock_level > 0 end |
#inactive? ⇒ Boolean
52 53 54 |
# File 'app/models/spina/shop/product_item.rb', line 52 def inactive? !active end |
#price_for_customer(customer) ⇒ Object
Get the price based on the one ordering. Can be different based on customer groups.
22 23 24 |
# File 'app/models/spina/shop/product_item.rb', line 22 def price_for_customer(customer) price end |
#product_images ⇒ Object
36 37 38 |
# File 'app/models/spina/shop/product_item.rb', line 36 def product_images product.product_images end |
#short_description ⇒ Object
Short description is description and description is the Product’s name and ProductItem’s name combined. Like wtf.
28 29 30 |
# File 'app/models/spina/shop/product_item.rb', line 28 def short_description description end |
#weight ⇒ Object
40 41 42 |
# File 'app/models/spina/shop/product_item.rb', line 40 def weight read_attribute(:weight) || BigDecimal(0) end |