Method: CanCan::ControllerAdditions::ClassMethods#skip_authorize_resource
- Defined in:
- lib/cancan/controller_additions.rb
#skip_authorize_resource(*args) ⇒ Object
Skip the authorization behavior of CanCan. This is useful when using load_and_authorize_resource but want to only do loading 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
:only => :index
end
You can also pass the resource name as the first argument to skip that resource.
218 219 220 221 222 |
# File 'lib/cancan/controller_additions.rb', line 218 def (*args) = args. name = args.first cancan_skipper[:authorize][name] = end |