Sha256: d4bcf4f72e7e83cdd77dc64ac0b9c90efa07bdf417c66af2b4a218f5d2d8087f

Contents?: true

Size: 885 Bytes

Versions: 5

Compression:

Stored size: 885 Bytes

Contents

module ESA
  module Filters
    module AccountableTypeFilter
      module TransactionAccountableType
        extend ActiveSupport::Concern

        included do
          scope :with_accountable_type, lambda { |type| joins(:transaction).where(esa_transactions: {accountable_type: type}) }
        end
      end

      module ObjectAccountableType
        extend ActiveSupport::Concern

        included do
          scope :with_accountable_type, lambda { |type| where(accountable_type: type) }
        end
      end
    end
  end
end

ESA::Amount.send :include, ESA::Filters::AccountableTypeFilter::TransactionAccountableType
ESA::Event.send :include, ESA::Filters::AccountableTypeFilter::ObjectAccountableType
ESA::Flag.send :include, ESA::Filters::AccountableTypeFilter::ObjectAccountableType
ESA::Transaction.send :include, ESA::Filters::AccountableTypeFilter::ObjectAccountableType

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
event_sourced_accounting-0.1.6 lib/esa/filters/accountable_type_filter.rb
event_sourced_accounting-0.1.4 lib/esa/filters/accountable_type_filter.rb
event_sourced_accounting-0.1.3 lib/esa/filters/accountable_type_filter.rb
event_sourced_accounting-0.1.1 lib/esa/filters/accountable_type_filter.rb
event_sourced_accounting-0.1.0 app/models/esa/filters/accountable_type_filter.rb