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

**URL:** <https://www.ruby-forum.com/t/render-update-doesnt-add-proper-script-tags-in-2-0/136975>\
**Category:** Rails\
**Created:** [May 7, 2008, 9:36pm UTC](https://www.ruby-forum.com/t/render-update-doesnt-add-proper-script-tags-in-2-0/136975 "2008-05-07T21:36:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [May 7, 2008, 9:36pm UTC](https://www.ruby-forum.com/t/render-update-doesnt-add-proper-script-tags-in-2-0/136975/1 "2008-05-07T21:36:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [May 8, 2008, 1:11am UTC](https://www.ruby-forum.com/t/render-update-doesnt-add-proper-script-tags-in-2-0/136975/2 "2008-05-08T01:11:41Z")

</div>

On Wed, May 7, 2008 at 3:35 PM, John W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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?
