guoren/app/controllers/application_controller.rb

16 lines
304 B
Ruby

class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include ApplicationHelper
include LoginHelper
# Confirms a logged-in user.
def logged_in_user
unless logged_in?
flash[:danger] = "请先登录"
redirect_to login_url
end
end
end