# Replace\_html problem

**URL:** <https://www.ruby-forum.com/t/replace-html-problem/156657>\
**Category:** Rails\
**Created:** [December 31, 2008, 2:34pm UTC](https://www.ruby-forum.com/t/replace-html-problem/156657 "2008-12-31T14:34:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sa125](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b4bc9f/32.png) [@sa125](https://www.ruby-forum.com/u/sa125)\
**Post date:** [December 31, 2008, 2:34pm UTC](https://www.ruby-forum.com/t/replace-html-problem/156657/1 "2008-12-31T14:34:55Z")

</div>

Hi - trying to update a table with page.replace\_html using a partial:

The view (index.html.erb):

[code=]

  
\<%= render :partial =\> ‘product’ %\>
[/code] The partial (\_product.html.erb) [code=] \<% for product in @products %\> \<% end %\>

| \<%= product.name %\> | \<%= product.vendor.name %\> |

[/code] The actual update: [code=]render :update do |page| page.replace\_html 'prod\_table', :partial =\> 'product' end[/code] I'm getting most of the page back, but the table is messed up, showing with a lot of \n\n characters (the javascript just shows up on the screen): try { Element.update("prod\_table", " \n\n \n \nProduct 1 \nVendor 1\n \n \nProduct 2 \nVendor 2\n \n \nProduct 3 \nVendor 3\n .. \n\n "); } catch(e){ alert('RJS error:\n\n' + e.toString()); alert('Element.update(\"prod\_table\",\" \\n \\n\\n ... and then the whole table again as a long string (it renders the error message on the screen.

What could be the problem?
