Skip to content
New issue

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

Make Pundit#authorize a module method. #227

Closed

Conversation

scottjacobsen
Copy link

There are cases where service objects could make use of the authorize
method. Make it a module method so it can be called without mixing in
Pundit.

Have the Pundit#authorize instance method delegate to Pundit::authorize
module method.

Be sure the instance method continues to cache the policy if found.

Closes #226

There are cases where service objects could make use of the authorize
method. Make it a module method so it can be called without mixing in
Pundit.

Have the Pundit#authorize instance method delegate to Pundit::authorize
module method.

Be sure the instance method continues to cache the policy if found.
@jnicklas
Copy link
Collaborator

Sorry to take so long on this PR. I've merged this with a small change in that I removed the extra policy argument to Pundit.authorize. Instead I've simply replicated the code in both places. A little less DRY, but more consistent as an interface.

@jnicklas jnicklas closed this Mar 26, 2015
@scottjacobsen
Copy link
Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make authorize a module method
2 participants