Module: Vpago::AdjustmentDecorator
- Defined in:
- app/models/vpago/adjustment_decorator.rb
Class Method Summary collapse
Class Method Details
.prepended(base) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/models/vpago/adjustment_decorator.rb', line 3 def self.prepended(base) base.enum handle_by: { store: 0, vendor: 1 }, _prefix: true base.scope :handle_by_vendor, -> { eligible.where(handle_by: :vendor) } base.scope :handle_by_store, -> { eligible.where(handle_by: :store) } base.before_save :set_handle_by def base.total sum(:amount) || 0 end end |