Sha256: 815e82827f0618733275deef4c95686088c69218986175f09961c062aa935aaa

Contents?: true

Size: 1.27 KB

Versions: 9

Compression:

Stored size: 1.27 KB

Contents

module ESA
  module Filters
    module AccountFilter
      module FlagTransactionAmountAccount
        extend ActiveSupport::Concern

        included do
          scope :with_account, lambda { |account| joins(:flags => {:transactions => :amounts}).where(esa_amounts: {account_id: account}) }
        end
      end

      module TransactionAmountAccount
        extend ActiveSupport::Concern

        included do
          scope :with_account, lambda { |account| joins(:transactions => :amounts).where(esa_amounts: {account_id: account}) }
        end
      end

      module AmountAccount
        extend ActiveSupport::Concern

        included do
          scope :with_account, lambda { |account| joins(:amounts).where(esa_amounts: {account_id: account}) }
        end
      end

      module ObjectAccount
        extend ActiveSupport::Concern

        included do
          scope :with_account, lambda { |account| where(account_id: account) }
        end
      end
    end
  end
end

ESA::Amount.send :include, ESA::Filters::AccountFilter::ObjectAccount
ESA::Event.send :include, ESA::Filters::AccountFilter::FlagTransactionAmountAccount
ESA::Flag.send :include, ESA::Filters::AccountFilter::TransactionAmountAccount
ESA::Transaction.send :include, ESA::Filters::AccountFilter::AmountAccount

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
event_sourced_accounting-0.2.6 lib/esa/filters/account_filter.rb
event_sourced_accounting-0.2.4 lib/esa/filters/account_filter.rb
event_sourced_accounting-0.2.3 lib/esa/filters/account_filter.rb
event_sourced_accounting-0.2.2 lib/esa/filters/account_filter.rb
event_sourced_accounting-0.1.6 lib/esa/filters/account_filter.rb
event_sourced_accounting-0.1.4 lib/esa/filters/account_filter.rb
event_sourced_accounting-0.1.3 lib/esa/filters/account_filter.rb
event_sourced_accounting-0.1.1 lib/esa/filters/account_filter.rb
event_sourced_accounting-0.1.0 app/models/esa/filters/account_filter.rb