Forum: Ruby on Rails replace_html and render action?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Heinz S. (Guest)
on 2009-02-26 21:51

is it possible to use replace_html together with a render :action?

This is my code:
render :update do |page|
  page.replace_html 'contentBody', render(:action => 'new')

and this is the confusing result in my contentBody:
try {
Element.update("contentBody", "");
} catch (e) { alert('RJS error:\n\n' + e.toString());
alert('Element.update(\"contentBody\", \"\");'
); throw e }

Why doesn't it work? Is there any alternative? It's a bit tricky
- I can't redirect_to because I need the content in 'contentBody'
- I can't render :action cause it wouldn't know where to put the content
(coming from a form_remote_tag)
- I can't use partials cause I need to use normal views

Anyone any idea? Thanks in advance!
Sijo k. (Guest)
on 2009-02-27 15:38
So from the view where you called this def you might have used
link_to_remote or some thing like that..isn't it? So add
:update => "contentBody"     to that

Now in action  just write

render :action => 'new'

Heinz S. (Guest)
on 2009-02-27 15:52
Yep, I just figured out that :update was missing right after I posted
that, thanks :)
This topic is locked and can not be replied to.