Class: Comable::OrderItem
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Comable::OrderItem
- Includes:
- Liquidable, Csvable, SkuChoice, SkuItem
- Defined in:
- app/models/comable/order_item.rb,
app/models/comable/order_item/csvable.rb
Defined Under Namespace
Modules: Csvable
Instance Method Summary collapse
- #complete ⇒ Object
-
#copy_attributes ⇒ Object
TODO: カート投入時との差額表示.
-
#current_price ⇒ Object
時価を取得.
-
#current_subtotal_price ⇒ Object
時価小計を取得.
- #restock ⇒ Object
-
#subtotal_price ⇒ Object
売価小計を取得.
- #unstock ⇒ Object
- #unstocked? ⇒ Boolean
Methods included from SkuChoice
Methods included from SkuItem
Instance Method Details
#complete ⇒ Object
23 24 25 |
# File 'app/models/comable/order_item.rb', line 23 def complete unstock end |
#copy_attributes ⇒ Object
TODO: カート投入時との差額表示
36 37 38 |
# File 'app/models/comable/order_item.rb', line 36 def copy_attributes self.attributes = current_attributes end |
#current_price ⇒ Object
時価を取得
41 42 43 |
# File 'app/models/comable/order_item.rb', line 41 def current_price stock.price end |
#current_subtotal_price ⇒ Object
時価小計を取得
46 47 48 |
# File 'app/models/comable/order_item.rb', line 46 def current_subtotal_price current_price * quantity end |
#restock ⇒ Object
31 32 33 |
# File 'app/models/comable/order_item.rb', line 31 def restock increment_stock end |
#subtotal_price ⇒ Object
売価小計を取得
51 52 53 |
# File 'app/models/comable/order_item.rb', line 51 def subtotal_price price * quantity end |
#unstock ⇒ Object
27 28 29 |
# File 'app/models/comable/order_item.rb', line 27 def unstock decrement_stock end |
#unstocked? ⇒ Boolean
55 56 57 58 59 |
# File 'app/models/comable/order_item.rb', line 55 def unstocked? stock_with_clean_quantity do |stock| stock.unstocked?(quantity: quantity) end end |