Class: Apartment::Elevators::Domain
- Defined in:
- lib/apartment/elevators/domain.rb
Overview
Provides a rack based tenant switching solution based on domain
Assumes that tenant name should match domain
Parses request host for second level domain, ignoring www
eg. example.com => example
www.example.bc.ca => example
a.example.bc.ca => a
Instance Method Summary collapse
Methods inherited from Generic
Constructor Details
This class inherits a constructor from Apartment::Elevators::Generic
Instance Method Details
#parse_tenant_name(request) ⇒ Object
16 17 18 19 20 |
# File 'lib/apartment/elevators/domain.rb', line 16 def parse_tenant_name(request) return nil if request.host.blank? request.host.match(/(www\.)?(?<sld>[^.]*)/)['sld'] end |