在application_controller.rb上的Rails 5(之前/之后)_filter弃用

时间:2016-05-31 00:45:08

标签: ruby-on-rails ruby-on-rails-5 deprecation-warning

我正在尝试将我的应用程序升级到Rails 5,并且我在使用(之前/之后)_filter时会收到弃用警告。但是,它们指向application_controller.rb的第1行。这是错误:

DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. 
(called from <top (required)> at /home/ubuntu/workspace/app/controllers/application_controller.rb:1)

这是我的整个application_controller:

class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  include Pundit
  protect_from_forgery with: :exception
end

如何修复这些错误?我的应用程序代码不使用这些函数,那么如何找到导致错误的组件?

1 个答案:

答案 0 :(得分:-1)

您的应用程序可能未在您的代码库中使用它,但您的一个或多个依赖项可能仍在使用before_filter。您可以尝试在github上检查其代码库,或者只是逐个删除它们以找到哪一个。

尽管如此,它可能已经有了拉动请求。