Skip to content
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

render_component fails when controller returns 304 #4

Open
elado opened this issue Sep 1, 2011 · 0 comments
Open

render_component fails when controller returns 304 #4

elado opened this issue Sep 1, 2011 · 0 comments

Comments

@elado
Copy link

elado commented Sep 1, 2011

When my controller returns 304 result, the render_component fails with this error:

undefined method `redirect_url' for []:Array

on this line:

response = component_response(options, true)[2]

** if response.redirect_url **
  redirect_to response.redirect_url
else
  render :text => response.body, :status => response.status
end

The reason is because controller.dispatch(action, request) returns an array with:

[304, {"ETag"=>"....", "Cache-Control"=>"max-age=0, private, must-revalidate"}, []]

instead of the 200 result which looks like:

[200, {"Content-Type"=>"text/html; charset=utf-8", "ETag"=>"\"...\"", "Cache-Control"=>"max-age=0, private, must-revalidate }, #<ActionDispatch::Response:0x007f8eee1918b8 @writer=...

Tried to add request_env["Cache-Control"] = "no-store, no-cache, must-revalidate" as a header but no luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant