0

config/initializers/apartment/subdomain_exclusions.rb

Apartment::Elevators::Subdomain.excluded_subdomains = ['www']

Above doesn't seems to be working. I'm using rails 5.0.2.

in apartment.rb I have this

Apartment::Elevators::Subdomain.excluded_subdomains = ['www', 'admin']
Rails.application.config.middleware.use'Apartment::Elevators::Subdomain'

To test on local i have added hosts

127.0.0.1 www.example.com admin.example.com

on www.example.com I got error Apartment::TenantNotFound What I'm missing here.

Tauqeer Ahmad
  • 540
  • 4
  • 9
  • Define *not working*. What do you expect it to do? What does it do instead? Is there a error message? What does it day? – spickermann Jul 12 '17 at 18:03
  • The documentation adds the middleware in the `config/application.rb` file and uses a constant not a string. Maybe one of those two things is creating an issue? https://github.com/influitive/apartment#switch-on-subdomain. Is your `apartment.rb` in `config/initializers`? – Puhlze Jul 12 '17 at 18:58
  • @spickermann By not working I meant that when I hit url www.example.com I should try to find any tenant rather it should use public database. – Tauqeer Ahmad Jul 13 '17 at 08:08
  • @Puhlze `apartment.rb` is in `config/initializers`. constant or string it does worked for me. – Tauqeer Ahmad Jul 13 '17 at 08:36

0 Answers0