# Render :update just displays code from JavaScriptGenerator

**URL:** <https://www.ruby-forum.com/t/render-update-just-displays-code-from-javascriptgenerator/186967>\
**Category:** Rails\
**Created:** [April 15, 2010, 1:50am UTC](https://www.ruby-forum.com/t/render-update-just-displays-code-from-javascriptgenerator/186967 "2010-04-15T01:50:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mstoth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/54ee81/32.png) [@mstoth](https://www.ruby-forum.com/u/mstoth)\
**Post date:** [April 15, 2010, 1:50am UTC](https://www.ruby-forum.com/t/render-update-just-displays-code-from-javascriptgenerator/186967/1 "2010-04-15T01:50:27Z")

</div>

I have looked around and seen similar problems but have not yet found  
a solution to this.

Relatively new to RoR, I am trying to use render :update to modify the  
displayed page in the browser.

No matter what I put in the render :update block, all I see is the  
code wrapped in the ‘try’ statement that the generator creates. It’s  
not executed, it’s just displayed on the browser. I’m sure there is  
something basic I’m missing here.

Any insight?

Thanks,  
Michael

---

<div class="post-metadata">

**Author:** ![mstoth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/54ee81/32.png) [@mstoth](https://www.ruby-forum.com/u/mstoth)\
**Post date:** [April 15, 2010, 4:46am UTC](https://www.ruby-forum.com/t/render-update-just-displays-code-from-javascriptgenerator/186967/2 "2010-04-15T04:46:39Z")

</div>

As an example, here’s the code in my controller:

def destroy  
@rehearsal = Rehearsal.find(params[:id])  
render :update do |page|  
page.call “delreh”, “rehearsal\_#{@rehearsal.id}”  
end  
end

and after this method is called, this is what I see on the browser:

try {  
delreh(“rehearsal\_15”);  
} catch (e) { alert(‘RJS error:\n\n’ + e.toString());  
alert(‘delreh(“rehearsal\_15”);’); throw e }

anyone please help. Thanks!

---

<div class="post-metadata">

**Author:** ![mstoth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/54ee81/32.png) [@mstoth](https://www.ruby-forum.com/u/mstoth)\
**Post date:** [April 15, 2010, 9:34am UTC](https://www.ruby-forum.com/t/render-update-just-displays-code-from-javascriptgenerator/186967/3 "2010-04-15T09:34:37Z")

</div>

On Apr 15, 3:45 am, mstoth [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> As an example, here’s the code in my controller:
> 
> def destroy  
> @rehearsal = Rehearsal.find(params[:id])  
> render :update do |page|  
> page.call “delreh”, “removed\_email\_address@domain.invalid}”  
> end  
> end

What does the link that invokes this look like ? You need to use  
link\_to\_remote (or similar) and you can’t use the update option to  
link\_to\_remote.

Fred
