Sha256: c6131083abcf7cb83c072c5a0b972a026f1b9a1afb1a69ad7e3f1c095b74c8b7

Contents?: true

Size: 570 Bytes

Versions: 4

Compression:

Stored size: 570 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 default_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

4 entries across 4 versions & 1 rubygems

Version Path
event_sourced_accounting-0.2.6 app/models/esa/contexts/accountable_type_context.rb
event_sourced_accounting-0.2.4 app/models/esa/contexts/accountable_type_context.rb
event_sourced_accounting-0.2.3 app/models/esa/contexts/accountable_type_context.rb
event_sourced_accounting-0.2.2 app/models/esa/contexts/accountable_type_context.rb