Class: Accountability::Credit
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Accountability::Credit
- Defined in:
- app/models/accountability/credit.rb
Instance Method Summary collapse
Methods inherited from ApplicationRecord
Instance Method Details
#base_price ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/models/accountability/credit.rb', line 19 def base_price if new_record? order_item.default_price else amount + total_deductions + taxes end end |
#total_deductions ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/models/accountability/credit.rb', line 27 def total_deductions if persisted? deductions.sum(:amount) else deductions.map(&:amount).sum end end |