Commit d8532968a9e57e4694d31245f1acec6071006d44
1 parent
e2f12c35
Exists in
master
and in
1 other branch
deploys pagination using kaminari
Showing
2 changed files
with
3 additions
and
3 deletions
Show diff stats
app/controllers/deploys_controller.rb
... | ... | @@ -16,8 +16,8 @@ class DeploysController < ApplicationController |
16 | 16 | app = App.find(params[:app_id]) |
17 | 17 | raise Mongoid::Errors::DocumentNotFound.new(App, app.id) unless current_user.admin? || current_user.watching?(app) |
18 | 18 | |
19 | - @deploys = app.deploys.order_by(:created_at.desc). | |
20 | - paginate(:page => params[:page], :per_page => 10) | |
19 | + @deploys = Kaminari.paginate_array(app.deploys.order_by(:created_at.desc)). | |
20 | + page(params[:page]).per(10) | |
21 | 21 | @app = app |
22 | 22 | end |
23 | 23 | ... | ... |
app/views/deploys/index.html.haml
... | ... | @@ -3,5 +3,5 @@ |
3 | 3 | - if current_user.authentication_token |
4 | 4 | %span= link_to 'iCal', app_deploys_path(@app, :format => "ics", :auth_token => current_user.authentication_token), :class => "calendar_link" |
5 | 5 | = render 'table', :deploys => @deploys |
6 | -= will_paginate @deploys, :previous_label => '« Previous', :next_label => 'Next »' | |
6 | += paginate @deploys | |
7 | 7 | ... | ... |