0

I'm using devise and acts_as_tenant gem and it seems the devise controllers don't inherit from ApplicationController (???) so don't have access to set_current_tenant_by_subdomain

When the password reset link is clicked I get no Tenant scoping by subdomain.

So how do you handle this? Is there an easy way to open up the DeviseControllers to ensure set_current_tenant_by_subdomain is called?

Thanks so much

Colin Goudie
  • 845
  • 5
  • 10

1 Answers1

1

There are a few steps to solve this.

  1. Customize the Devise views to include the tenant details. You can do it by using rails generate devise:views and editing the generated views.
  2. Patch DeviseController so that it includes set_current_tenant_by_subdomain. DeviseController is inherited by the device controllers (confirmations, registrations, forgot password, etc.)

The patching would look something like this:

class DeviseController < Devise.parent_controller.constantize
  set_current_tenant_by_subdomain(:account, :subdomain)
end
catcyborg
  • 344
  • 1
  • 10