Skip to content

Instantly share code, notes, and snippets.

@mokevnin
Created February 9, 2012 09:18
Show Gist options
  • Select an option

  • Save mokevnin/1778680 to your computer and use it in GitHub Desktop.

Select an option

Save mokevnin/1778680 to your computer and use it in GitHub Desktop.
class Ability
include CanCan::Ability
def initialize(user)
can :create, EventPhoto
if (user && user.roles)
if user.roles.map(&:to_sym).include?(:do_manager)
can :manage, [Attachment, Blog, Comment, EventPhoto, Event, Message, News, StoredFile,:title]
end
if user.roles.map(&:to_sym).include?(:menu_manager)
can :manage, Menu
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment