2012-01-19 2 views
1

레일 3, 액티브 어드민 및 카 미나리를 사용하고 있습니다.Rails 3. 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> 

답변

3

를 사용하여 페이지 매개 변수가 아닌 ID입니다.

@shipments = Shipment.page(params[:page]).per(3)

+0

Doh! 고마워 제임스 – leonel

관련 문제