-
-
Save ssorallen/3259498 to your computer and use it in GitHub Desktop.
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 Ability | |
include CanCan::Ability | |
def initialize user, options = {} | |
can :read, :all if !user | |
can :manage, :all if user.has_role?(:admin) | |
can :manage, Measurement do |m| | |
m.user == user | |
end | |
can :create, Measurement | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment