2016-07-26 54 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中。

相關問題