Created
December 30, 2014 06:25
-
-
Save hoguej/dc09550137b71ba698b7 to your computer and use it in GitHub Desktop.
example pundit policy file
This file contains hidden or 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
class MessagePolicy < ApplicationPolicy | |
def create? | |
return true if user.admin? | |
user.rooms.inlcude?(record.room) | |
end | |
def show? | |
return true if user.admin? | |
user.rooms.inlcude?(record.room) | |
end | |
def update? | |
user.admin? | |
end | |
def delete? | |
message.user == user | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment