微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby – 在Rails 5控制器中的undefined方法respond_to

我正在将一个应用程序从rails 3.something升级到rails 5.出于某种原因,我在任何时候在任何控制器中使用该方法时都会得到未经证实的方法respond_to.这是以前工作,我希望有人在这里可以提供帮助.
class StatusController < ApplicationController

  #this throws an error 'undefined method respond_to
  respond_to :json,:html     
 end

解决方法

按照 Rails 5 release notes,

Remove respond_to/respond_with placeholder methods,this functionality
has been extracted to the responders gem.

将响应者gem添加到您的Gemfile中.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐