Module: InvestorAccountDelegation::Klass

Defined in:
app/delegations/investor_account_delegation.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/delegations/investor_account_delegation.rb', line 10

def method_missing(method_sym, *args)
  scope = method_sym.to_s.upcase
  if InvestorConstants.constants.include?(scope.to_sym)
    scope_value = const_get scope
    if scope.split(/_/)[0] == 'TIER'
      return where(investor_tier: scope_value)
    end
    if scope.split(/_/)[0] == 'STATUS'
      return where(approval_status: scope_value)
    end
  end
  super
end