about summary refs log tree commit diff
path: root/app/models/concerns/paginable.rb
blob: 54552ae3d876434d03ffed3dce6bcfb14a07fffa (plain) (blame)
1
2
3
4
5
6
7
module Paginable
  extend ActiveSupport::Concern

  included do
    scope :paginate_by_max_id, -> (limit, max_id) { order('id desc').limit(limit).where(max_id.nil? ? '1=1' : ['id < ?', max_id]) }
  end
end