RubyMine shows alert 'Cannot find "before_action" '

2.1k views Asked by At

RubyMine7.0.1 shows this alert in every controller class.
A controller class file below. Thanks.

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
1

There are 1 answers

0
ytg On

I got the very same error when I imported a project from existing sources and the Project SDK was not set properly for the project.