Module: Amorail::Leadable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/amorail/entities/leadable.rb
Overview
Lead associations
Instance Method Summary collapse
-
#initialize(*args) ⇒ Object
Set initial value for linked_leads_id to [].
-
#leads ⇒ Object
Return all linked leads.
-
#reload ⇒ Object
Clear leads cache on reload.
Instance Method Details
#initialize(*args) ⇒ Object
Set initial value for linked_leads_id to []
11 12 13 14 |
# File 'lib/amorail/entities/leadable.rb', line 11 def initialize(*args) super self.linked_leads_id ||= [] end |
#leads ⇒ Object
Return all linked leads
23 24 25 26 |
# File 'lib/amorail/entities/leadable.rb', line 23 def leads return [] if linked_leads_id.empty? @leads ||= Amorail::Lead.find_all(linked_leads_id) end |
#reload ⇒ Object
Clear leads cache on reload
17 18 19 20 |
# File 'lib/amorail/entities/leadable.rb', line 17 def reload @leads = nil super end |