2016-07-26 55 views
7

我正在升级应用程序从rails 3.something到rails 5.出于某种原因,我正在获取undefindied方法respond_to任何时候我在我的任何控制器中使用该方法。这是以前工作,我希望有人在这里可以帮助。未定义的方法respond_to Rails 5控制器

class StatusController < ApplicationController 

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

您必须将'gem'responders''添加到您的Gemfile中。 – Aetherus

+2

请参阅http://stackoverflow.com/questions/35983628/undefined-instance-method-respond-to-in-rails-5-api-controller – nikkypx

回答

16

作为每Rails 5 release notes,

删除的respond_to/respond_with占位符的方法,该功能 已提取到应答宝石。

responders添加到您的Gemfile中。

相关问题