app/controllers/application_controller.rb
def require_user
    return if logged_in?

    flash[:danger] = 'You must be logged in to perform that action.'
    redirect_to root_path
  end
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception.
For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception . For APIs you may want to use : null_session instead .
def require_user
    return if logged_in?
    flash[:danger] = 'You must be logged in to perform that action.'
    redirect_to root_path
  end
def require_user return if logged_in? flash [ :danger ] = 'You must be logged in to perform that action.' redirect_to root_path end
Prevent CSRF attacks by raising an exception.
Prevent CSRF attacks by raising an exception .