I need a simple method in my application controller that requires all users to be logged in before going to any part of the site. I use Devise for authentication.
I tried:
class ApplicationController < ActionController::Base
...
unless user_signed_in?
redirect_to login_path
end
...
end
This successfully redirects everyone, but the problem is that it also prevents mailing a request to create a new user session.
So my question is: how are you going to block all requests except the login and the send request?
source
share