Render :update and script tags

Pedro Cardoso wrote:

I'm using render :update do |page| page.replaca_html :element , :partial => 'apartial' end

Is this inside a view, or up in a controller?

This is working well, since I see in the page the following code:

try { Element.update("element", ""); } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.update("element", \"");'); throw e }

I simplified the output.

My problem is that no script tag is generated and the code is not executed!

How can I fix this?

Inside a view, use update_page_tag(). I think render :update works different inside a view. You could, for example, stack up many render :updates inside one view <script> tag.

But prefer using a controller, because "that's what everyone else does". If possible!