Module: Cancannible::ControllerAdditions

Defined in:
lib/cancannible/grantee.rb

Overview

This module is automatically included into all controllers. It overrides some CanCan ControllerAdditions

Instance Method Summary collapse

Instance Method Details

#current_abilityObject

Returns abilities cached in the current_user model. If that fails, returns a default Ability instance



109
110
111
112
113
# File 'lib/cancannible/grantee.rb', line 109

def current_ability
  current_user.try(:abilities) || if ability_class = ('::Ability'.constantize rescue nil)
    ability_class.new(current_user)
  end
end