Class: Comable::OrderItem
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Comable::OrderItem
- 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
22 23 24 |
# File 'app/models/comable/order_item.rb', line 22 def complete unstock end |
#copy_attributes ⇒ Object
TODO: カート投入時との差額表示
35 36 37 |
# File 'app/models/comable/order_item.rb', line 35 def copy_attributes self.attributes = current_attributes end |
#current_price ⇒ Object
時価を取得
40 41 42 |
# File 'app/models/comable/order_item.rb', line 40 def current_price stock.price end |
#current_subtotal_price ⇒ Object
時価小計を取得
45 46 47 |
# File 'app/models/comable/order_item.rb', line 45 def current_subtotal_price current_price * quantity end |
#restock ⇒ Object
30 31 32 |
# File 'app/models/comable/order_item.rb', line 30 def restock increment_stock end |
#subtotal_price ⇒ Object
売価小計を取得
50 51 52 |
# File 'app/models/comable/order_item.rb', line 50 def subtotal_price price * quantity end |
#unstock ⇒ Object
26 27 28 |
# File 'app/models/comable/order_item.rb', line 26 def unstock decrement_stock end |
#unstocked? ⇒ Boolean
54 55 56 57 58 |
# File 'app/models/comable/order_item.rb', line 54 def unstocked? stock_with_clean_quantity do |stock| stock.unstocked?(quantity: quantity) end end |