简体   繁体   English

在将 Rails 从 4.1 更新到 5.2 并添加响应者 gem 后,为我的控制器获取“未定义的方法`flash`”

[英]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

在 Rails 升级到 5.2 和 ruby 到 2.5.7 后,# <http::client error in my rails project< div><div id="text_translate"><p> 在 rails 升级到 5.2 版和 ruby 到 2.5.7 之后,我的 rails 项目出现以下错误,我也升级了faraday gem,但无法解决这个问题。 任何帮助都是可取的。</p><pre> NoMethodError: undefined method `prepend' for #&lt;HTTP::Client:0x00007ff4dc21a470&gt; Did you mean? present?</pre></div></http::client> - After Rails Upgrade to 5.2 and ruby to 2.5.7 getting undefined method `prepend' for #<HTTP::Client error in my rails project

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Rails 升级到 5.2 和 ruby 到 2.5.7 后,# <http::client error in my rails project< div><div id="text_translate"><p> 在 rails 升级到 5.2 版和 ruby 到 2.5.7 之后,我的 rails 项目出现以下错误,我也升级了faraday gem,但无法解决这个问题。 任何帮助都是可取的。</p><pre> NoMethodError: undefined method `prepend' for #&lt;HTTP::Client:0x00007ff4dc21a470&gt; Did you mean? present?</pre></div></http::client> - After Rails Upgrade to 5.2 and ruby to 2.5.7 getting undefined method `prepend' for #<HTTP::Client error in my rails project 使用带有Rails 5的responders gem - Using responders gem with Rails 5 设计中禁用响应者gem flash消息 - Disable Responders gem flash message for devise sign in 更新到Rails 5.2后运行rails时,Active_shipping Gem加载错误 - Active_shipping Gem Load Error when running rails s after updating to Rails 5.2 升级后:conditions Rails 4.1的未定义方法“ call” - Undefined method 'call' for :conditions Rails 4.1 after upgrade 未定义的方法“变形虫”导轨 5.2 - undefined method `amoeba' rails 5.2 Rails money-rails gem在获利方面获得未定义的方法 - Rails money-rails gem getting undefined method on monetize Rails 4.1:Rails:Module的未定义方法“应用程序” - Rails 4.1: undefined method `application' for Rails:Module 响应者gem:在Flash消息中添加模型的基本错误? - Responders gem: add a model's base errors to the flash message? 未定义的方法index_path,Rails 4.1 - Undefined method index_path, Rails 4.1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM