Skip to content

Instantly share code, notes, and snippets.

@stabenfeldt
Forked from kennyadsl/ability.rb
Created February 9, 2016 17:29
Show Gist options
  • Save stabenfeldt/5c63d5a133fb1ab3ec41 to your computer and use it in GitHub Desktop.
Save stabenfeldt/5c63d5a133fb1ab3ec41 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