This repository has been archived on 2019-05-14. You can view files and clone it, but cannot push or open issues or pull requests.
mastodon/app/models/concerns/paginable.rb

8 lines
206 B
Ruby
Raw Normal View History

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