Method: CanCan::ControllerAdditions::ClassMethods#skip_load_resource
- Defined in:
- lib/cancan/controller_additions.rb
#skip_load_resource(*args) ⇒ Object
Skip the loading behavior of CanCan. This is useful when using load_and_authorize_resource but want to only do authorization on certain actions. You can pass :only and :except options to specify which actions to skip the effects on. It will apply to all actions by default.
class ProjectsController < ApplicationController
skip_load_resource :only => :index
end
You can also pass the resource name as the first argument to skip that resource.
202 203 204 205 206 |
# File 'lib/cancan/controller_additions.rb', line 202 def skip_load_resource(*args) = args. name = args.first cancan_skipper[:load][name] = end |