Class: Spree::Reimbursement::Credit
- Inherits:
-
Base
- Object
- ApplicationRecord
- Base
- Spree::Reimbursement::Credit
show all
- Defined in:
- app/models/spree/reimbursement/credit.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
page, spree_base_scopes
#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference
Class Method Details
.total_amount_reimbursed_for(reimbursement) ⇒ Object
12
13
14
|
# File 'app/models/spree/reimbursement/credit.rb', line 12
def total_amount_reimbursed_for(reimbursement)
reimbursement.credits.to_a.sum(&:amount)
end
|
Instance Method Details
#description ⇒ Object
17
18
19
|
# File 'app/models/spree/reimbursement/credit.rb', line 17
def description
creditable.class.name.demodulize
end
|
#display_amount ⇒ Object
21
22
23
|
# File 'app/models/spree/reimbursement/credit.rb', line 21
def display_amount
Spree::Money.new(amount, { currency: creditable.try(:currency) || "USD" })
end
|