I am using this apartment a ruby gem.
I have add this in application.rb file:
config.middleware.use 'Apartment::Elevators::Subdomain'
When i try hit this in browser url 'test.domain.local:3000' where sub domain 'test' schema does not exist in PostgreSQL, i see this error
Apartment::SchemaNotFound (One of the following schema(s) is invalid: test, "public")
I know this is normal behavior of gem but want to catch this exception and redirect user to some other page, how can i do that?
This is what I did:
Create file under lib/rescued_apartment_middleware.rb
and add to your Apartment initializer file following lines:
This works like a charm! (Tested with ruby 2.1 and Rails 4.1)