You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've run into cases where it would be nice to use the authorize method outside a controller. It would be handy to be able to do Pundit.authorize(user, record, :edit?) where that method would raise Pundit::NotAuthorizedError if the action is not authorized.
It seems like it would be a simple matter of making the current authorize method a module method that takes three arguments - user, record, query, and making the current authorize instance method delegate to that method.
I would be happy to submit a PR if that sounds like it is worth doing.
The text was updated successfully, but these errors were encountered:
I've run into cases where it would be nice to use the
authorize
method outside a controller. It would be handy to be able to doPundit.authorize(user, record, :edit?)
where that method would raisePundit::NotAuthorizedError
if the action is not authorized.It seems like it would be a simple matter of making the current
authorize
method a module method that takes three arguments -user, record, query
, and making the currentauthorize
instance method delegate to that method.I would be happy to submit a PR if that sounds like it is worth doing.
The text was updated successfully, but these errors were encountered: