app/controllers/application_controller.rb
def requires_logged_out_user
    if current_user
      flash[:error] = "You can't do that while logged in!"
      redirect_to root_path and return
    end
  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 requires_logged_out_user
    if current_user
      flash[:error] = "You can't do that while logged in!"
      redirect_to root_path and return
    end
  end
def requires_logged_out_user if current_user flash [ :error ] = "You can't do that while logged in!" redirect_to root_path and return end end
Prevent CSRF attacks by raising an exception.
Prevent CSRF attacks by raising an exception .