Using Devise before_action :authenticate_user! doesn't do anything

Here's the actual code we use:

#app/controllers/application_controller.rb
Class ApplicationController < ActionController::Base
   #Actions
   before_action :authenticate_user! #-> routes to the login / signup if not authenticated
end

The problem you probably have is two-fold:

--

Make sure your other controllers are inheriting from application_controller:

#app/controllers/other_controller.rb
Class OtherController < ApplicationController 
    ...
end

--

You're somehow "skipping" the before_action callback

If you're using skip_before_action anywhere, you need to remove it. It will likely cause a problem with your authenticate_user! method. To fix this, I would firstly test without any skip_before_action callbacks, and then see what gets it working correctly


A further note - signin / signup won't matter. They all inherit from the Devise controllers; they'll just run as required.