Module: Comfy::Paginate

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

Instance Method Summary collapse

Instance Method Details

#comfy_paginate(scope, per_page: 50) ⇒ Object

Wrapper to deal with WillPaginate vs Kaminari nonsense


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

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