Module: InvestorAccountAccessor

Defined in:
app/accessors/investor_account_accessor.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
5
6
7
8
9
# File 'app/accessors/investor_account_accessor.rb', line 2

def self.included(base)
  base.class_eval do
    belongs_to :member
    has_many :wallets # will be destroyed by bank account cascade destroy
    has_many :bank_accounts, dependent: :destroy
    has_many :investor_state_transitions, dependent: :destroy, class_name: InvestorAccount.investor_state_transition_klass.to_s
  end
end

Instance Method Details

#account_idObject



16
17
18
# File 'app/accessors/investor_account_accessor.rb', line 16

def 
  '#' + id.to_s.rjust(6, '0')
end

#investmentsObject



11
12
13
14
# File 'app/accessors/investor_account_accessor.rb', line 11

def investments
  wallet_ids = wallets.pluck(:id)
  investment_klass.where(wallet_id: wallet_ids)
end

#long_account_idObject



20
21
22
# File 'app/accessors/investor_account_accessor.rb', line 20

def 
  'U' + id.to_s.rjust(6, '0')
end