0

我正在使用设计和acts_as_tenant gem,似乎设计控制器没有从ApplicationController(???)继承,所以无权访问set_current_tenant_by_subdomain

单击密码重置链接时,我没有按子域确定租户范围。

那么你如何处理呢?有没有一种简单的方法可以打开 DeviseControllers 以确保调用 set_current_tenant_by_subdomain ?

非常感谢

4

1 回答 1

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
于 2013-05-26T02:52:26.037 回答