RubyMine显示警告’找不到’before_action“’

栏目: Ruby · 发布时间: 6年前

内容简介:当我从现有源导入项目并且没有为项目正确设置Project SDK时,我得到了同样的错误.翻译自:https://stackoverflow.com/questions/27575293/rubymine-shows-alert-cannot-find-before-action

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

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

翻译自:https://stackoverflow.com/questions/27575293/rubymine-shows-alert-cannot-find-before-action


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

PHP&MySQL Web数据库应用开发指南

PHP&MySQL Web数据库应用开发指南

Hugb E. Williams、David Lane / 谢君英 / 中国电力出版社 / 2003-5 / 69.00元

一起来看看 《PHP&MySQL Web数据库应用开发指南》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

MD5 加密
MD5 加密

MD5 加密工具

SHA 加密
SHA 加密

SHA 加密工具