Module: Controllers::SubdomainDetection
- Extended by:
- ActiveSupport::Concern
- Included in:
- ApplicationController
- Defined in:
- app/concerns/controllers/subdomain_detection.rb
Overview
Subdomain and request type detection
Provides methods for detecting which subdomain (CRM, WWW, API) the request
is targeting and what format is requested.
Usage:
if is_crm_request?
# CRM-specific logic
elsif is_www_request?
# WWW-specific logic
end
Instance Method Summary collapse
-
#is_crm_request? ⇒ Boolean
protected
Check if request is to the CRM subdomain.
-
#is_www_request? ⇒ Boolean
protected
Check if request is to the WWW subdomain.
-
#json_request? ⇒ Boolean
protected
Check if this is a JSON format request.
Instance Method Details
#is_crm_request? ⇒ Boolean (protected)
Check if request is to the CRM subdomain
25 26 27 |
# File 'app/concerns/controllers/subdomain_detection.rb', line 25 def is_crm_request? request.subdomain =~ /^crm/ end |
#is_www_request? ⇒ Boolean (protected)
Check if request is to the WWW subdomain
30 31 32 |
# File 'app/concerns/controllers/subdomain_detection.rb', line 30 def is_www_request? request.subdomain =~ /^www/ end |
#json_request? ⇒ Boolean (protected)
Check if this is a JSON format request
20 21 22 |
# File 'app/concerns/controllers/subdomain_detection.rb', line 20 def json_request? request.format.json? end |