Class: Comable::OrderDetail
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Comable::OrderDetail
- Defined in:
- app/models/comable/order_detail.rb
Instance Method Summary collapse
- #complete ⇒ Object
-
#copy_attributes ⇒ Object
TODO: カート投入時との差額表示.
-
#current_price ⇒ Object
時価を取得.
-
#current_subtotal_price ⇒ Object
時価小計を取得.
-
#subtotal_price ⇒ Object
売価小計を取得.
- #unstocked? ⇒ Boolean (also: #soldout_stock?)
Methods included from SkuChoice
Methods included from SkuItem
Instance Method Details
#complete ⇒ Object
22 23 24 25 |
# File 'app/models/comable/order_detail.rb', line 22 def complete copy_attributes decrement_stock end |
#copy_attributes ⇒ Object
TODO: カート投入時との差額表示
28 29 30 |
# File 'app/models/comable/order_detail.rb', line 28 def copy_attributes self.attributes = current_attributes end |
#current_price ⇒ Object
時価を取得
33 34 35 |
# File 'app/models/comable/order_detail.rb', line 33 def current_price stock.price end |
#current_subtotal_price ⇒ Object
時価小計を取得
38 39 40 |
# File 'app/models/comable/order_detail.rb', line 38 def current_subtotal_price current_price * quantity end |
#subtotal_price ⇒ Object
売価小計を取得
43 44 45 |
# File 'app/models/comable/order_detail.rb', line 43 def subtotal_price price * quantity end |
#unstocked? ⇒ Boolean Also known as: soldout_stock?
47 48 49 50 51 |
# File 'app/models/comable/order_detail.rb', line 47 def unstocked? stock_with_clean_quantity do |stock| stock.unstocked?(quantity: quantity) end end |