I have a few controllers which are used for specific purposes and each have a “def index” function. Like /index uses the home page and calls the unauthenticated home page. /jobs/index is another and /users/index is another. Each of them are using different controllers like JobsController, HomeController, UsersController.
My ApplicationController has a before_Filter
before_filter :authenticate_user!, :except => [:index]
The problem with this is that this will also skip when I call /jobs/index or /users/index (or any other /*/index page for that matter). Is there a way so that I can apply the “/except” clause only to “home#index” request (ie HomeController -> index page). I tried,
before_filter :authenticate_user!, :except => ["home#index"] but it doesn't work.
You can use
in your
home_controllerfor skipping the before_filter for that action…