Module: Occams::Paginate

Included in:
Admin::BaseController
Defined in:
app/controllers/concerns/occams/paginate.rb

Instance Method Summary collapse

Instance Method Details

#occams_paginate(scope, per_page: 50) ⇒ Object

Wrapper to deal with WillPaginate vs Kaminari nonsense



5
6
7
8
9
10
11
12
13
# File 'app/controllers/concerns/occams/paginate.rb', line 5

def occams_paginate(scope, per_page: 50)
  if defined?(WillPaginate)
    scope.paginate(page: params[:page], per_page: per_page)
  elsif defined?(Kaminari)
    scope.page(params[:page]).per(per_page)
  else
    scope
  end
end