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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B0a417a921e705ad0a605ff666d9b074?d=identicon&s=25 Joost (Guest)
on 2009-02-06 10: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
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?
This topic is locked and can not be replied to.