Pre-loading polymorphic associations for Atom feeds
This commit is contained in:
7
app/models/concerns/paginable.rb
Normal file
7
app/models/concerns/paginable.rb
Normal file
@ -0,0 +1,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
|
Reference in New Issue
Block a user