Open hatsu38 opened 1 year ago
Same issue here - $request_env always nil. Did you figure this out?
I believe this is just an example where you'd have to set a variable to access the request. @cmer made that PR to the Gemfile and can probably give some tips on that. https://github.com/ErwinM/acts_as_tenant/pull/286
For example, you might want to use CurrentAttributes
and set Current.request
in a before_action so you can access it inside the lambda.
We may need to update the readme to show a complete example like that.
Thank you for telling me. I misunderstood that I could use a variable called $request_env, but now I understand that I need to set the variable.
As you said, I'm glad the readme has a better example.
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?