Class: Tenantify::Resolvers::Subdomain
- Inherits:
-
Object
- Object
- Tenantify::Resolvers::Subdomain
- Defined in:
- lib/tenantify/resolvers/subdomain.rb
Instance Method Summary collapse
- #call(request) ⇒ Object
-
#initialize(exclude: %w[www],, attribute: :subdomain) ⇒ Subdomain
constructor
A new instance of Subdomain.
Constructor Details
#initialize(exclude: %w[www],, attribute: :subdomain) ⇒ Subdomain
Returns a new instance of Subdomain.
6 7 8 9 |
# File 'lib/tenantify/resolvers/subdomain.rb', line 6 def initialize(exclude: %w[www], attribute: :subdomain) @exclude = Array(exclude) @attribute = attribute end |
Instance Method Details
#call(request) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/tenantify/resolvers/subdomain.rb', line 11 def call(request) subdomain = request.subdomain return nil if subdomain.blank? || @exclude.include?(subdomain) Tenantify.tenant_class.find_by(@attribute => subdomain) end |