Forum: Ruby on Rails Weird mime type set by render_to_string (Rails 2.2 / 2.3)

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Joost (Guest)
on 2009-02-06 11:58
(Received via mailing list)
When using 'render_to_string' in your views (for some special
reason :) ) the response.content_type is set to the wrong value I

I have a:

respond_to do |format|
  format.js {}

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

Any opinions?
This topic is locked and can not be replied to.