rails/rails — Issue #5238: rails 3.2.2: rendering a partial from a controller returns an invalid content-type
Author: yob
Created: 2012-03-02 02:58:08+00:00
State: open

If I render a partial from a controller in a brand new rails 3.2.2 app then the following content type is returned:

Content-Type: ; charset=utf-8

To reproduce, start with a new rails app:

rails new foo

Add a resource

./script/rails g resource person

Fill in the PeopleController as suggested in #5025

class PeopleController < ApplicationController
def index
render partial: 'james', formats: :html
end
end

Add content to the partial

⚡ cat app/views/people/_james.html.erb

Hello World

Load the action:

⚡ curl -v http://127.0.0.1:3000/people
* About to connect() to 127.0.0.1 port 3000 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 3000 (#0)
> GET /people HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-pc-linux-gnu) libcurl/7.24.0 OpenSSL/1.0.0g zlib/1.2.6 libidn/1.23 libssh2/1.2.8 librtmp/2.3
> Host: 127.0.0.1:3000
> Accept: */*
>
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
< Content-Type: ; charset=utf-8
< X-Ua-Compatible: IE=Edge
< Etag: "cb058f946972a4d5413cfee068e298cf"
< Cache-Control: max-age=0, private, must-revalidate
< X-Request-Id: 9089271888581c058a8d3228067b7e1f
< X-Runtime: 0.002992
< Content-Length: 19
< Server: WEBrick/1.3.1 (Ruby/1.9.3/2011-10-30)
< Date: Fri, 02 Mar 2012 02:42:48 GMT
< Connection: Keep-Alive
<

Hello World

* Connection #0 to host 127.0.0.1 left intact
* Closing connection #0

Here's my environment details:

⚡ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

⚡ rails -v
Rails 3.2.2

⚡ bundle -v
Bundler version 1.0.22

⚡ uname -a
Linux gaz 3.2.0-1-amd64 #1 SMP Tue Feb 28 15:35:32 UTC 2012 x86_64 GNU/Linux