-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Controller with render :partial returns empty content_type #5238
Comments
I could reproduce it in a bare controller with
|
DAMN. dude, sorry for wiping your post :( Sorry, I was 99 percent sure github at least checks for owner... but He doesnt :( What a bug-day |
Yup, this can be easily reproduced also in tests, I'm checking it |
@yob please check it out that the commit fixes the issue |
Yep, this seems to work as expected on the 3-2-stable branch |
Will this fix be in the next Rails release? |
@cantino yes |
I encountered the same problem. I would like to test if the patch above would fix my problem, however I'm not quite sure on how I would do that. Is there by chance any guidance on what I would need to do? |
@jhilden please test pointing to 3-2-stable branch in your Gemfile ...
And let me know if everything works for you. |
Thank you for your guidance @spastorino. I installed rails from the However my functional test for this controller action was still broken. Weirdly, in the test the content-tpye in the response header changed from empty to In my controller I'm just doing a
When comparing the HTTP headers of the two different XHRs (from Firebug and from the
First, I'm not sure if this is the intended behavior for the |
@jhilden I think that it returns text/javascript because it gets the first mime time that it finds in accept, but I guess it should be text/html as partial is html type, so this may be a bug. I will check it. |
@jhilden does this commit looks like something that should fail? It passes for me and I'm not sure what's the difference from your app. |
@jhilden also, can you confirm that this also happends outside of tests? You can try with |
@drogus I tried it with curl and it's correctly returning Do you have any idea what could be the problem/difference in my test? Is there a way to look at the pure HTTP request header (besides the stuff in the request object)? |
@jhilden actually I found the problem and it's not only the matter of test. It will fail when you also make it xhr request (in a way that rails understands it) Could you confirm that your test now does not fail on fresh 3-2-stable? The problem is, when you send request headers that I used, ie. |
@drogus now it works with the latest |
If I render a partial from a controller in a brand new rails 3.2.2 app then the following content type is returned:
To reproduce, start with a new rails app:
Add a resource
Fill in the PeopleController as suggested in #5025
Add content to the partial
Load the action:
Here's my environment details:
The text was updated successfully, but these errors were encountered: