Sha256: 24a108b81084a9b8e81f40c0b364f5f964166fb0946117127bf639a0f22764f4

Contents?: true

Size: 569 Bytes

Versions: 5

Compression:

Stored size: 569 Bytes

Contents

module ESA
  module Contexts
    class AccountableTypeContext < ESA::Context
      attr_accessible :accountable_type
      attr_readonly   :accountable_type

      validates_presence_of :accountable_type

      protected

      def create_name
        "#{self.accountable_type} accountables" unless self.accountable_type.nil?
      end

      def initialize_filters
        @filters = []

        if self.accountable_type.present?
          @filters << lambda { |relation| relation.with_accountable_type(self.accountable_type) }
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
event_sourced_accounting-0.1.6 app/models/esa/contexts/accountable_type_context.rb
event_sourced_accounting-0.1.4 app/models/esa/contexts/accountable_type_context.rb
event_sourced_accounting-0.1.3 app/models/esa/contexts/accountable_type_context.rb
event_sourced_accounting-0.1.1 app/models/esa/contexts/accountable_type_context.rb
event_sourced_accounting-0.1.0 app/models/esa/contexts/accountable_type_context.rb