Skip to content

Instantly share code, notes, and snippets.

@metalelf0
Created March 2, 2012 09:25
Show Gist options
  • Save metalelf0/1957141 to your computer and use it in GitHub Desktop.
Save metalelf0/1957141 to your computer and use it in GitHub Desktop.
# create a file in config/initializers, e.g. add_abilities_to_spree.rb,
# with the following content:
Spree::Ability.register_ability MyAppAbility
# create a file under app/models (or lib/) to define your abilities (in
# this example I protect only the HostAppCoolPage model):
class MyAppAbility
include CanCan::Ability
def initialize(user)
if user.has_role?('admin')
can manage, :host_app_cool_pages
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment