Sha256: dd7c3672a867011b4d57ff9d778b35c53ce5964aa6086d6f54ca727605a416ea
Contents?: true
Size: 611 Bytes
Versions: 122
Compression:
Stored size: 611 Bytes
Contents
module Spree class Reimbursement::Credit < Spree::Base class_attribute :default_creditable_class self.default_creditable_class = nil belongs_to :reimbursement, inverse_of: :credits belongs_to :creditable, polymorphic: true validates :creditable, presence: true class << self def total_amount_reimbursed_for(reimbursement) reimbursement.credits.to_a.sum(&:amount) end end def description creditable.class.name.demodulize end def display_amount Spree::Money.new(amount, currency: creditable.try(:currency) || 'USD') end end end
Version data entries
122 entries across 122 versions & 1 rubygems
Version | Path |
---|---|
spree_core-3.4.0.rc2 | app/models/spree/reimbursement/credit.rb |
spree_core-3.4.0.rc1 | app/models/spree/reimbursement/credit.rb |