Weird mime type set by render_to_string (Rails 2.2 / 2.3)


#1

When using ‘render_to_string’ in your views (for some special
reason :slight_smile: ) the response.content_type is set to the wrong value I
think.

I have a:

respond_to do |format|
format.js {}
end

which in the view uses the render_to_string method. The returned
content type is ‘text/html’ instead of ‘text/javascript’. Now I have
to fix this using something like:

  content_type = response.content_type
  tooltip = render_to_string(:layout => false, :partial => "places/

map_tooltip", :locals => {:place => place})
response.content_type = content_type

There are lots of tickets on this but I think it still isn’t
resolved :S

http://rails.lighthouseapp.com/projects/8994/tickets/1182

Any opinions?