Module: MemberAccessor

Defined in:
app/accessors/member_accessor.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'app/accessors/member_accessor.rb', line 2

def self.included(base)
  base.class_eval do
    has_many :identities, dependent: :destroy, primary_key: :email, foreign_key: :email
    has_one :member_profile, dependent: :destroy
    alias_method :profile, :member_profile
    has_one :investor_account, dependent: :destroy
    alias_method :investor, :investor_account
    has_one :preference, dependent: :destroy
    has_many :session_analytics, dependent: :destroy
  end
end

Instance Method Details

#ageObject



14
15
16
# File 'app/accessors/member_accessor.rb', line 14

def age
  TimeDifference.between(date_of_birth, Date.today).in_years.to_i if date_of_birth.present?
end

#investmentsObject



18
19
20
# File 'app/accessors/member_accessor.rb', line 18

def investments
   && .investments
end

#is_approved_investor?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/accessors/member_accessor.rb', line 26

def is_approved_investor?
  is_investor? && investor.approval_status == ::InvestorConstants::STATUS_APPROVED
end

#is_investor?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/accessors/member_accessor.rb', line 22

def is_investor?
  investor.present? and investor.approval_status != ::InvestorConstants::STATUS_NON_INVESTOR
end