Forum: Ruby on Rails replace_html problem

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.
sa 1. (Guest)
on 2008-12-31 15:34
Hi - trying to update a table with page.replace_html using a partial:

The view (index.html.erb):
[code=]<div id='prod_table'>
  <%= render :partial => 'product' %>
The partial (_product.html.erb)
<% for product in @products %>
  <td><%= %></td>
  <td><%= %></td>
<% end %>
The actual update:
[code=]render :update do |page|
  page.replace_html 'prod_table', :partial => 'product'
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
try { Element.update("prod_table", "
\n  \nProduct 1   \nVendor 1\n
\n  \nProduct 2   \nVendor 2\n
\n  \nProduct 3   \nVendor 3\n
"); } catch(e){ alert('RJS error:\n\n' + e.toString());
... and then the whole table again as a long string (it renders the
error message on the screen.

What could be the problem?
This topic is locked and can not be replied to.