Why is respond_with being removed from rails 4.2 into it's own gem?

前端 未结 1 910
孤街浪徒
孤街浪徒 2020-12-03 01:06

In rails 4.2 respond_with has been moved out of core into the responders gem.

Beta release notes.

respond_with has moved out and into its own proper ho

相关标签:
1条回答
  • 2020-12-03 01:26

    Rationale from David Heinemeier Hansson (creator of Ruby on Rails):

    I'd like to take this opportunity to split respond_with/class-level respond_to into an external plugin. I'm generally not a fan of the code that comes out of using this pattern. It encourages model#to_json and it hides the difference between HTML and API responses in ways that convolute the code.

    So how about we split this into a gem for 4.2, with the current behavior, but also with an option to get the new behavior as suggested here through a configuration point.

    Full discussion at this link:

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

    0 讨论(0)
提交回复
热议问题