Created
May 7, 2014 22:14
-
-
Save wdawson4/c201be9fc652a0669832 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pundit makes the following assumptions about this class: | |
The class has the same name as some kind of model class, only suffixed with the word "Policy". | |
The first argument is a user. In your controller, Pundit will call the current_user method to retrieve what to send into this argument | |
The second argument is some kind of model object, whose authorization you want to check. This does not need to be an ActiveRecord or even an ActiveModel object, it can be anything really. | |
The class implements some kind of query method, in this case update?. Usually, this will map to the name of a particular controller action. | |
That's it really. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment