[英]Getting "undefined method `flash`" for my controllers after updating Rails from 4.1 to 5.2 and added the responders gem
I'm in the process of updating rails from 4.1 to 5.2 I added the responders
gem so respond_with is present.我正在将 Rails 从 4.1 更新到 5.2,我添加了
responders
gem,因此存在responders
。 My ApplicationController now looks like this:我的 ApplicationController 现在看起来像这样:
class ApplicationController < ActionController::API self.responder = ApplicationResponder respond_to :html
However, when I call respond_with
I get this error:但是,当我调用
respond_with
我收到此错误:
NoMethodError: undefined method `flash' for #<MyController>
I noticed in the responders README that there is a flash responder, however I do not want to use that.我在响应者自述文件中注意到有一个快速响应器,但是我不想使用它。
add the following line to "config/environments/production.rb"将以下行添加到“config/environments/production.rb”
config.middleware.use ActionDispatch::Flash config.middleware.use ActionDispatch::Flash
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.