Traditionally, this is done using the before_action filter. Something like that:
class ApplicationController before_action :require_current_user def require_current_user redirect_to login_path unless current_user end end class SessionsController < ApplicationController
In addition, helpers are designed to simplify browsing (currency formatting, styling, etc.). They are not used for this kind of function (session management in this case).
source share