I am using ActsAsTenant.
Recently, I wanted to change require_tenant dynamically because I plan to create an admin page.
So I looked at the README and rewrote acts_as_tenant.rb using lambda.
cat config/initializers/acts_as_tenant.rb
ActsAsTenant.configure do |config|
config.require_tenant = lambda do
puts "*" * 30
p $request
p $request_env
puts "*" * 30
if $request_env.present?
return false if $request_env["REQUEST_PATH"].start_with?("/admin/")
end
true
end
end
But $request_env is always nil even though the controller is working, so $request_env.present? is still false
******************************
nil
nil
******************************
Is there any way to set require_tenant to false only for the /admin path?
I am using ActsAsTenant.
Recently, I wanted to change require_tenant dynamically because I plan to create an admin page.
So I looked at the README and rewrote acts_as_tenant.rb using lambda.
cat config/initializers/acts_as_tenant.rb
But $request_env is always nil even though the controller is working, so $request_env.present? is still false
Is there any way to set require_tenant to false only for the /admin path?