Frage

I'm using Rails 3, ActiveAdmin and Kaminari.

I have this on the documents.rb file (activeadmin file).

collection_action :index do
  @page_title = "Documents"
  @shipments = Shipment.page(params[:id]).per(3)
  render '_invoices', :layout => 'active_admin'
end

The pagination links are displayed fine. I click the pagination links and I do get this in the URL http://localhost:3000/admin/documents?page=4 so it seems fine. The problem is, it always displays the same records, they don't change according to the page.

This is what I have as the partial that is being rendered...

<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>

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top