-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
default_render has a breaking change in Rails 5 #126
Comments
Thanks!
So, I pass some dummy options like following. module My
class AppResponder < ActionController::Responder
include Responders::FlashResponder
include Responders::HttpCacheResponder
# @see https://github.com/plataformatec/responders/issues/126
def default_render
if @default_response
@default_response.call(options)
else
controller.default_render(options) do
raise ActionView::MissingTemplate.new([], "", [], true, []) # <--------
end
end
end
end
end |
Closing this since #131 was merged. @davetron5000 thanks for reporting it! Can you please give master branch a try? @ppworks thanks for the patch! |
This solves the problem I was seeing. Thanks!!! |
I'm still having issues using respond_with on rails 5 using ActionController::API as the base controller. Below is the controller I'm testing against:
The respond_with call eventually makes it to the actionpack/lib/abstract_controller/rendering.rb # Normalizes arguments, options and then delegates render_to_body and
# sticks the result in <tt>self.response_body</tt>.
# :api: public
def render(*args, &block)
options = _normalize_render(*args, &block)
self.response_body = render_to_body(options)
_process_format(rendered_format, options) if rendered_format
self.response_body
end EditThis may all be caused because Active Model Serializers no longer support respond_with according to this bug in AMS repo. I understand their argument but it would have been nice to satisfy devise serialization without the need to override every devise method. EditThe empty string that does get returned (" ") is not valid json. I'm going to revert back to the older version until this is fixed for devise/active model serializer |
See rails/rails#20276
Opening this issue to get some guidance on how to use the fix in Rails 5 to fix this gem.
Basically, this: https://github.com/plataformatec/responders/blob/master/lib/action_controller/responder.rb#L236 will no longer raise
ActionView::MissingTemplate
, which is what much logic is assuming will happen.I believe the fix should be something like:
but I have very little familiarity with this gem (I discovered this issue because devise uses this gem and my devise-based flow stopped working on Rails master).
So, I'm happy to do the work of trying to address this, but wondering if someone more familiar with the codebase can let me know if this is the right general approach.
The text was updated successfully, but these errors were encountered: