Skip to content

Instantly share code, notes, and snippets.

@joshsmith
Created November 14, 2012 01:01
Show Gist options
  • Select an option

  • Save joshsmith/4069521 to your computer and use it in GitHub Desktop.

Select an option

Save joshsmith/4069521 to your computer and use it in GitHub Desktop.
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user (not logged in)
can :manage, User, :id => user.id
can :manage, Comment, :user_id => user.id
can :manage, CommentVote, :user_id => user.id
can :read, :all
can :create, [ArtworkLike,ArtworkFlag,Comment,CommentVote,Relationship,
Service,Tag,TemporaryImage,User]
if user.artist?
can :manage, Artwork, :user_id => user.id
can :manage, ArtworkTag, :user_id => user.id
can :create, Artwork
can :create, ArtworkTag
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment