Rails 5 个未定义的方法“before_filter”包含在其中。摩拜莱特
Rails 5 undefined method `before_filter' in include. Mobylette
当 运行 rails 时出现以下错误
RoR 5.1.5 乘客独立
ActionController::RoutingError (undefined method 'before_filter' for
ApplicationController:Class Did you mean? before_action):
app/controllers/application_controller.rb:4:in 'include'
app/controllers/application_controller.rb:4:in
`'
app/controllers/application_controller.rb:1:in ''
app/controllers/welcome_controller.rb:1:in ''
^CExitingStopping web server...
application_controller.rb
class ApplicationController < ActionController::Base
before_action :require_login
include Mobylette::RespondToMobileRequests
private
def not_authenticated
redirect_to login_path, alert: "Please login first"
end
end
此拉取请求修复了错误,但尚未拉取。
当 运行 rails 时出现以下错误 RoR 5.1.5 乘客独立
ActionController::RoutingError (undefined method 'before_filter' for ApplicationController:Class Did you mean? before_action):
app/controllers/application_controller.rb:4:in 'include' app/controllers/application_controller.rb:4:in `' app/controllers/application_controller.rb:1:in '' app/controllers/welcome_controller.rb:1:in '' ^CExitingStopping web server...
application_controller.rb
class ApplicationController < ActionController::Base
before_action :require_login
include Mobylette::RespondToMobileRequests
private
def not_authenticated
redirect_to login_path, alert: "Please login first"
end
end
此拉取请求修复了错误,但尚未拉取。