2011-01-29 43 views
0

在我的HTML我有:調用對象屬性時來自何處的附加數據在哪裏?

<table class="customers" summary="User customers"> 
<%= @customers.each do |customer| %> 
<tr> 
<td class="customer"><%= customer.mobile %></td> 
<td class="timestamp">Added <%= time_ago_in_words(customer.created_at) %> ago.</td> 
</tr> 
<% end %> 
</table> 

數據的第一行寫着:

#<Customer:0x103061018>#<Customer:0x10304c910>#<Customer:0x10304c7a8>#<Customer:0x10304c668> 

預期之前:

5234567894加1天前。
5234567893新增1天前。
5234567892 1天前新增。

什麼是第一行數據,我該如何擺脫它?

回答

4

而不是

<%= @customers.each do |customer| %> 

嘗試

<% @customers.each do |customer| %> 

(所以沒有等號)。

等號告訴Rails打印'<%'和'%>'之間的結果。

+0

啊,愚蠢的錯誤。謝謝。 – Greg 2011-01-29 19:34:02

相關問題