module Amorail::Leadable

Lead associations

Public Class Methods

new(*args) click to toggle source

Set initial value for linked_leads_id to []

Calls superclass method
# File lib/amorail/entities/leadable.rb, line 13
def initialize(*args)
  super
  self.linked_leads_id ||= []
end

Public Instance Methods

leads() click to toggle source

Return all linked leads

# File lib/amorail/entities/leadable.rb, line 25
def leads
  return [] if linked_leads_id.empty?

  @leads ||= Amorail::Lead.find_all(linked_leads_id)
end
reload() click to toggle source

Clear leads cache on reload

Calls superclass method
# File lib/amorail/entities/leadable.rb, line 19
def reload
  @leads = nil
  super
end