Render :text problem in RoR

software development


I asked DH support about this, but they hold that it’s application-specific, so here goes.

I have a Ruby on Rails app that sometimes sends text back to the client for use by Ajax scripts. The text is just supposed to be placed in an element. To make a simple example of this, I added this method to a controller:

def test
render :text => "foo"

I have a public and a staging version of my app. The staging app runs on the goober server, which incidentally runs Ruby 1.8.5. Rails version is 2.1.1. On goober, calling this action puts “foo” on the screen. Yay.

My public version of the app is on starfox. Ruby 1.8.7. Rails 2.1.1 again. Same code. But when I call my test method from the browser, nothing is displayed as a result. Firebug in Firefox claims it got 3 bytes worth of response (the char length of “foo”, and yes I’ve varied the return string and Firebug faithfully reports the correct length of response), but there seems to be nothing there. When I call this from Safari, I get “bad server response” (NSURLErrorDomain:-1011), which, from searching on Google, means Safari doesn’t know what just happened to it.

Anyone seen anything like this? Nothing else seems to be wrong with my app. It’s just the behavior of render :text.