Class: WholesalerAbility

Inherits:
Object
  • Object
show all
Includes:
CanCan::Ability
Defined in:
lib/spree_wholesale/wholesaler_ability.rb

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ WholesalerAbility

Returns a new instance of WholesalerAbility.



5
6
7
8
9
10
11
12
13
# File 'lib/spree_wholesale/wholesaler_ability.rb', line 5

def initialize(user) 
  user ||= User.new 
  can :index,  Wholesaler
  can :new,    Wholesaler
  can :create, Wholesaler
  can :read,   Wholesaler do |resource|
    resource.user == user
  end    
end