2011-01-29 7 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日前に追加されました。

データの最初の行とは何ですか、どうすればそのデータを削除できますか?代わり

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

答えて

4

は(等号無しに)

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

を試みます。

等号は、 '<%'と '%>'の間の結果を表示するようにRailsに指示しています。

+0

ああ、愚かな間違い。ありがとう。 – Greg

関連する問題