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'm not sure how this could work, but it would probably be very useful if allowed users to return an error message when forbidding.
I imagine it could look something like this:
defupdate?returntrueifuser.admin? || resource.author == user[false,'You must be an admin or the author to update an article.']end# somewhere elseresult,error=policy.update?
The only semantic issue with this proposal is that predicate methods are supposed to return a boolean, while this would make them return true or an array.
The text was updated successfully, but these errors were encountered:
aldesantis
changed the title
Allow returning an optional message with the policy error
Forbidden messages
Jul 15, 2018
I'm not sure how this could work, but it would probably be very useful if allowed users to return an error message when forbidding.
I imagine it could look something like this:
The only semantic issue with this proposal is that predicate methods are supposed to return a boolean, while this would make them return
true
or an array.The text was updated successfully, but these errors were encountered: