Skip to content

Instantly share code, notes, and snippets.

@kennyadsl
Created February 9, 2016 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kennyadsl/a926c736ffaa85d931f0 to your computer and use it in GitHub Desktop.
Save kennyadsl/a926c736ffaa85d931f0 to your computer and use it in GitHub Desktop.
# app/models/spree/custom_ability.rb
module Spree
class CustomAbility
include CanCan::Ability
def initialize(user)
can [:action], Spree.user_class, id: user.id
end
end
end
# config/initializers/spree.rb
Spree::Ability.register_ability(Spree::CustomAbility)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment