[英]Rails 3. Kaminari displays pagination links but doesn't change the records
我正在使用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>
使用page參數而不是id。
@shipments = Shipment.page(params[:page]).per(3)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.