Class: Spree::Ability

Inherits:
Object
  • Object
show all
Includes:
CanCan::Ability
Defined in:
app/models/spree/ability.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, options = {}) ⇒ Ability

Returns a new instance of Ability.



24
25
26
27
28
29
30
31
# File 'app/models/spree/ability.rb', line 24

def initialize(user, options = {})
  alias_cancan_delete_action

  @user = user || Spree.user_class.new
  @store = options[:store] || Spree::Current.store

  apply_permissions_from_sets
end

Instance Attribute Details

#storeSpree::Store? (readonly)

Returns the current store.

Returns:



22
23
24
# File 'app/models/spree/ability.rb', line 22

def store
  @store
end

#userObject (readonly)

Returns the current user.

Returns:

  • (Object)

    the current user



19
20
21
# File 'app/models/spree/ability.rb', line 19

def user
  @user
end