Sha256: c4a4a56b95eb74341c3d05da84d47b01c66405316e3d08d88ef4bfff8f4ddd9a

Contents?: true

Size: 603 Bytes

Versions: 4

Compression:

Stored size: 603 Bytes

Contents

module ESA
  module Contexts
    class AccountContext < ESA::Context
      attr_accessible :account, :account_id
      attr_readonly   :account, :account_id

      belongs_to :account

      validates_presence_of :account

      protected

      def default_name
        self.account.name unless self.account.nil?
      end

      def default_position
        self.account.code.gsub(/[^0-9]/, '').to_i unless self.account.nil? or self.account.code.nil?
      end

      def initialize_filters
        @filters = [lambda { |relation| relation.with_account(self.account_id) }]
      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/account_context.rb
event_sourced_accounting-0.2.4 app/models/esa/contexts/account_context.rb
event_sourced_accounting-0.2.3 app/models/esa/contexts/account_context.rb
event_sourced_accounting-0.2.2 app/models/esa/contexts/account_context.rb