Render :update doesn't add proper script tags in 2.0?

Guys,

I’m using render :update in a few places in an app we just upgraded
from 1.2 to 2.0.2. However, :update seems to be broken in 2.0.2.
Consider the following:

class TesterController < ApplicationController
def test_it
render :update do |page|
page.alert(“This is a test”)
end
end
end

I then drive this from the console:

Loading development environment (Rails 2.0.2)

require ‘action_controller/test_process’
require ‘application’
require ‘tester_controller’
request = ActionController::TestRequest.new
response = ActionController::TestResponse.new
request.env[‘REQUEST_METHOD’] = ‘GET’
request.action = “test_it”
rs = TesterController.process(request,response)
rs.body
=> “try {\nalert(“JOHN”);\n} catch (e) { alert(‘RJS error:\n\n’ +
e.toString()); alert(‘alert(\“This is a test\”);’); throw e }”

Now, in the past, with older Rails versions (1.x), I am almost 100%
sure this would’ve looked like:

rs.body
=> “<script language=“javascript”>try {\nalert(“JOHN”);\n} catch
(e) { alert(‘RJS error:\n\n’ + e.toString()); alert(‘alert(\“This
is a test\”);’); throw e }”

In other words, the response would be surrounded by:

As it is, this breaks a lot of our app.

Can someone tell me what I’m missing? Am I wrong?

Thanks,
John

On Wed, May 7, 2008 at 3:35 PM, John W. [email protected]
wrote:

Guys,

I’m using render :update in a few places in an app we just upgraded
from 1.2 to 2.0.2. However, :update seems to be broken in 2.0.2.
Consider the following:

Ok, so I looked at the headers coming back across, and it appears that
the mime type is set properly to indicate Javascript. So now I’m
doubting whether a tag was ever involved.

The problem is exhibited by the fact that in_place_editors from
scriptaculous used to evaluate this returned code properly as
javascript (evalScripts:true), but they no longer work. Could it be
that it’s not Rails that has changed, but scriptaculous?