我正在使用 Rails 3、ActiveAdmin 和 Kaminari。
我在documents.rb 文件(activeadmin 文件)上有这个。
collection_action :index do
@page_title = "Documents"
@shipments = Shipment.page(params[:id]).per(3)
render '_invoices', :layout => 'active_admin'
end
分页链接显示正常。我单击分页链接,我确实在 URL 中得到了这个,http://localhost:3000/admin/documents?page=4
所以看起来很好。问题是,它总是显示相同的记录,它们不会根据页面而改变。
这就是我所拥有的正在渲染的部分......
<table class="index_table">
<tr>
<th>File #</th>
... buncla th's
</tr>
<% @shipments.each do |shipment| %>
<tr class="<%= cycle("odd", "even") %>">
<td><%= link_to shipment.file_number, admin_shipment_path(shipment) %></td>
...buncha cells...
</tr>
<% end %>
</table>
<div id="index_footer"><%= paginate @shipments %></div>