I'm building a multi-tenant app with ActiveAdmin as the main admin interface. I've used the acts_as_tenant gem to accomplish data separate nicely.
I've used the AdminUser model as the user model object for all users.
In order to add other users, the AdminUser is scoped to the tenant as well.
This is throwing off the login, because when ActiveAdmin/Devise tries to authenticate, I assume it is first hitting the find_tenant filter as shown below:
class ApplicationController
set_current_tenant_through_filter
before_filter :find_tenant
def find_tenant
if admin_user_signed_in?
set_current_tenant(Company.find(current_admin_user.company_id))
end
end
Not sure how to get around this... I want the user to login and then the application takes the company_id from the logged in user and sets the tenant and all data shown on ActiveAdmin is scoped via that tenant (this part works well through the acts_as_tenant gem if I can get past the login).
Thanks