Skip to content

Instantly share code, notes, and snippets.

@ssorallen
Forked from Kellyreid/gist:3259476
Created August 4, 2012 19:32
Show Gist options
  • Save ssorallen/3259498 to your computer and use it in GitHub Desktop.
Save ssorallen/3259498 to your computer and use it in GitHub Desktop.
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