Module: Motor::CurrentAbility
- Included in:
- ApiBaseController, ApplicationController
- Defined in:
- app/controllers/concerns/motor/current_ability.rb
Instance Method Summary collapse
Instance Method Details
#current_ability ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/concerns/motor/current_ability.rb', line 5 def current_ability @current_ability ||= if defined?(Motor::Ability) klass = Motor::Ability.dup.tap do |k| k.prepend(Motor::CancanUtils::AbilityPatch) end params = [current_user] params << request if Motor::Ability.instance_method(:initialize).arity == 2 klass.new(*params) else Motor::CancanUtils::CanManageAll.new end end |