Rails 5控制器中的undefined方法respond_to

时间:2016-07-26 22:05:10

标签: ruby ruby-on-rails-5

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

class StatusController < ApplicationController

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

1 个答案:

答案 0 :(得分:18)

根据Rails 5 release notes,

  

删除respond_to / respond_with占位符方法,此功能   已被提取到响应者宝石。

responders gem添加到您的Gemfile中。