$('#reserved_table').find('tbody').empty(); <% @sales.each_with_index do |sale, key| %> var row = $("<%= j render(:partial => 'customer_reserved_sale', :locals => {:sale => sale}) %>"); $('#reserved_table > tbody:last-child').append(row); <% end %>