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 []
13 14 15 16 |
# File 'lib/amorail/entities/leadable.rb', line 13 def initialize(*args) super self.linked_leads_id ||= [] end |
#leads ⇒ Object
Return all linked leads
25 26 27 28 29 |
# 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 ⇒ Object
Clear leads cache on reload
19 20 21 22 |
# File 'lib/amorail/entities/leadable.rb', line 19 def reload @leads = nil super end |