11

RubyMine7.0.1 在每个控制器类中显示此警报。
下面的控制器类文件。谢谢。

application_controller.rb

class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception
  helper_method :current_user, :logged_in?
  before_action :authenticate

  private
  def current_user
    return unless sessions[:user_id]
    @current_user ||= User.find(session[:user_id])
  end

  def logged_in?
    !!session[:user_id]
  end

  def authenticate
    return if logged_in?
    redirect_to root_path, alert: 'ログインして下さい。'
  end
end
4

1 回答 1

0

当我从现有源导入项目并且项目 SDK 没有为该项目正确设置时,我遇到了同样的错误。

于 2016-12-04T21:58:41.123 回答