RubyMine shows alert 'Cannot find "before_action" '
Asked Answered
B

1

11

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
Bettencourt answered 19/12, 2014 at 23:23 Comment(2)
Could you please show the complete declaration of the class?Kilohertz
Thanks! I added a controller class. Every class show this alert.Bettencourt
S
0

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.

Stammer answered 4/12, 2016 at 21:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.