Ruby-on-Railsでページ内の項目一覧を表示したい。パーシャルを使っています
私のindex.html.erb
ファイルには次のものがあります:
<%= @lista = News.find(:all, :order => Document::COL_DATE + ' DESC, id DESC')
render :partial => "newsitem",
:layout => "list_news",
:spacer_template => "spacer",
:collection => @lista
%>
私が_list_news.html.erb
持っている:
<div class="news">
<%= yield %>
</div>
_spacer.html.erb
私が持っている<hr/>
_newsitem.html.erb
私が持っている
<%= newsitem_counter + 1 %>
<!-- Code to print details for one item -->
問題は、リストを複数回出力することです。
リストに 3 つの項目がある場合、1、2、3、1、2、3、1、2、3 の 3 回表示されます。
7 つの項目がある場合、それらの項目は 7 回印刷されます。
私のコードで何が間違っていますか?