Specify which controllers to exclude from before_filter Specify which controllers to exclude from before_filter ruby-on-rails ruby-on-rails

Specify which controllers to exclude from before_filter


In the controller where you want to skip a before filter specified in an inherited controller, you can tell rails to skip the filter

class ApplicationController  before_filter :authenticate_user!endclass SessionsController < ApplicationController  skip_before_filter :authenticate_user!end


You can qualify a filter with :only or :except.

before_filter :filter_name, :except => [:action1, :action2]

Or if the filter (as I now see is the case in your situation) is defined in ApplicationController and you want to bypass it in a subclass controller, you can use a skip_before_filter with the same qualifications in the subclass controller:

skip_before_filter :filter_name, :except => [:action1, :action2]


In config/application.rb

config.to_prepare do  Devise::SessionsController.skip_before_filter :authenticate_user!end

Referenced by:

How to skip a before_filter for Devise's SessionsController?