为什么将respond_with从rails 4.2中移除到它自己的gem中?

在rails 4.2中, respond_with已经从核心转移到了响应者的gem中。

Beta版本说明。

respond_with has moved out and into its own proper home with the responders gem.

有人可以解释为什么吗? 是什么让响应者成为适当的家? 它留在Rails的gem有什么不对?

David Heinemeier Hansson(Ruby on Rails的创build者)的理由:

我想借此机会将respond_with / class-level respond_to拆分为一个外部插件。 我通常不是使用这种模式的代码迷。 它鼓励模型#to_json,并以卷积代码的方式隐藏HTML和API响应之间的差异。

那么我们如何将它分解为4.2的gem和当前的行为,还可以通过configuration点来获得新的行为。

在此链接进行充分讨论:

https://github.com/rails/rails/pull/12136#issuecomment-50216483