Forum: Ruby on Rails Ajax :update used when redirect_to 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.
Ee0293412faca21e4ebf3326ed9d5f8c?d=identicon&s=25 Kad Kerforn (kadoudal)
on 2007-02-08 11:40
This action is called via an Ajax request... with a parameter  :update
 def modify_prop
    @ proposal = Proposal.find_by_id(params[:id])
# modify the proposal attribute.....
# if saved then redirect to proposal list
    redirect_to(:action => "list_ proposal", :id => current_user ) and
return if @
# if error : redisplay proposal with errors
    render :update do |page|
      page.replace_html 'mypropForm', :partial => 'myprop_form'

when saved, the redirect is performed... but the llist_ proposal action
doesn't render the full layout as it should....  it just render the
partial ! even if  the redirect_to request is not an xml_http_request

why this :update parameter is still used anyway to get rid of it in the
redirect ?

thanks  to Ajaxian gurus

A2c85dc5ee81b12e3cc0a6522e8d079d?d=identicon&s=25 Chris Hall (au5lander)
on 2007-02-08 12:51
(Received via mailing list)
you really don't want to mix your rendering like that. and there is no
need to use :update => 'mypropForm' in the ajax call in your view, as
you are doing a page.replace_html.

you're making an ajax request, so instead of redirec_to, you should do

render :update do |page|
    page.redirect_to ...
    page.replace_html 'mypropForm', :partial => 'myprop_form'
This topic is locked and can not be replied to.