Created
March 2, 2012 09:25
-
-
Save metalelf0/1957141 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
# 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