Commit d8532968a9e57e4694d31245f1acec6071006d44

Authored by Marcin Ciunelis
1 parent e2f12c35
Exists in master and in 1 other branch production

deploys pagination using kaminari

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