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