I am using the before_action
filter to call authenticate
which is a method that will redirect users back to their home page if they aren't authorized to be on the page requested.
I would like to exclude a page from this step, just for testing purposes.
What I have seen so far is that I can use except
to exclude certain controller actions from being subject to the before_action
filter so like:
before_action :authenticate, except: :demo_login
I can also exclude more than one action at a time like this:
before_action :authenticate, except [:demo_login, :demo_show]
Use skip_before_action :authenticate
in the relevant controller.
The format of this method is the same as before_action
so if you want to skip calling :authenticate
for a specific controller action, use:
skip_before_action :authenticate, only: [:show, :index]
The except:
keyword can also be used.