Module: CrmLinkable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Party
- Defined in:
- app/models/concerns/crm_linkable.rb
Overview
Shared CRM link generation for Party STI types.
Chooses the Rails URL helper from the model’s singular route key (customer, contact, etc.).
Instance Method Summary collapse
-
#crm_link(with_host: false, host: CRM_HOSTNAME) ⇒ String
Builds the CRM path or absolute URL for this record.
-
#crm_link_with_host ⇒ String
Same as #crm_link with
with_host: true.
Instance Method Details
#crm_link(with_host: false, host: CRM_HOSTNAME) ⇒ String
Builds the CRM path or absolute URL for this record.
:reek:BooleanParameter :reek:ControlParameter
16 17 18 19 20 21 22 23 |
# File 'app/models/concerns/crm_linkable.rb', line 16 def crm_link(with_host: false, host: CRM_HOSTNAME) route_key = model_name.singular_route_key if with_host UrlHelper.instance.public_send(:"#{route_key}_url", self, host:) else UrlHelper.instance.public_send(:"#{route_key}_path", self) end end |
#crm_link_with_host ⇒ String
Same as #crm_link with with_host: true.
28 29 30 |
# File 'app/models/concerns/crm_linkable.rb', line 28 def crm_link_with_host crm_link(with_host: true) end |