We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What's the recommended way to scope collections on a controller when a user isn't logged in, and a current_user isn't available?
As in a public listing available to non-registered users, and a private one for logged-in ones.
The text was updated successfully, but these errors were encountered:
Well, current_user could return nil then, which you could check in the actual Policy. Depending on the outcome of this you act.
current_user
nil
Sorry, something went wrong.
I see, policy_scope() won't barf by not having current_user set then... should have checked for that :) thanks
What about doing this in application_controller?
include Pundit def pundit_user current_user ||= User.new # guest user end
No branches or pull requests
What's the recommended way to scope collections on a controller when a user isn't logged in, and a current_user isn't available?
As in a public listing available to non-registered users, and a private one for logged-in ones.
The text was updated successfully, but these errors were encountered: