# AJAX "render :partial" does not update if specified view matches current view

**URL:** <https://www.ruby-forum.com/t/ajax-render-partial-does-not-update-if-specified-view-matches-current-view/172401>\
**Category:** Rails\
**Created:** [July 21, 2009, 12:38am UTC](https://www.ruby-forum.com/t/ajax-render-partial-does-not-update-if-specified-view-matches-current-view/172401 "2009-07-21T00:38:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomuhs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecb155/32.png) [@tomuhs](https://www.ruby-forum.com/u/tomuhs)\
**Post date:** [July 21, 2009, 12:38am UTC](https://www.ruby-forum.com/t/ajax-render-partial-does-not-update-if-specified-view-matches-current-view/172401/1 "2009-07-21T00:38:32Z")

</div>

I have some simple code that renders a form to an element specified in  
form\_remote\_tag :update. The problem is that, if the loaded view  
matches the view to render, Rails does nothing rather than refreshing  
the view (which is the desired behavior).

There is an element with id “form,” also specified in the form tag:

Here’s how the form is built:

\<% form\_remote\_tag(  
:url =\> {  
:action =\> ‘create’,  
:id =\> params[:id]  
},  
:update =\> ‘form’  
) do -%\>

The exit code in this controller action:

when ‘Save’  
render :partial =\> ‘edit’  
when ‘Save and New’  
render :partial =\> ‘new’

The view that contains this form is the “new” partial. So, the idea is  
that if a user clicks “Save and New” they will have the “new” view  
refreshed rather than being moved to the edit screen.

Is what I’m attempting possible with render :partial?

Thomas

---

<div class="post-metadata">

**Author:** ![tomuhs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecb155/32.png) [@tomuhs](https://www.ruby-forum.com/u/tomuhs)\
**Post date:** [July 22, 2009, 2:52pm UTC](https://www.ruby-forum.com/t/ajax-render-partial-does-not-update-if-specified-view-matches-current-view/172401/2 "2009-07-22T14:52:27Z")

</div>

Is what I’m attempting possible with render :partial?

---

<div class="post-metadata">

**Author:** ![tomuhs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecb155/32.png) [@tomuhs](https://www.ruby-forum.com/u/tomuhs)\
**Post date:** [July 22, 2009, 3:04pm UTC](https://www.ruby-forum.com/t/ajax-render-partial-does-not-update-if-specified-view-matches-current-view/172401/3 "2009-07-22T15:04:10Z")

</div>

On Jul 22, 1:51 pm, Thomas A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is what I’m attempting possible with render :partial?

Have you checked with firebug to see what is actually going back and  
forth between the browser and the server ? (fun issues like the  
browser helpfully autocompleteing the new fields for you ?)

Fred

---

<div class="post-metadata">

**Author:** ![tomuhs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecb155/32.png) [@tomuhs](https://www.ruby-forum.com/u/tomuhs)\
**Post date:** [July 22, 2009, 4:23pm UTC](https://www.ruby-forum.com/t/ajax-render-partial-does-not-update-if-specified-view-matches-current-view/172401/4 "2009-07-22T16:23:09Z")

</div>

Hm, I’ll try explicitly setting the [nonstandard] autocomplete  
attribute off in the inputs…

Thomas

On Jul 22, 9:02 am, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
