about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-03-22 21:53:33 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-03-22 21:53:33 +0100
commit082e1cbe5a6bcff291e0fe96260ca8920776a18e (patch)
tree8fe26747c88ff2b70e961f715f72958e5195f08e /app/models
parent12559b01eae408c0f3e820ef9c6bc6e356ab889a (diff)
Fix default max_id query in paginate_by_max_id
Diffstat (limited to 'app/models')
-rw-r--r--app/models/status.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index f1c12383b..68f4adf34 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -17,7 +17,7 @@ class Status < ActiveRecord::Base
 
   scope :with_counters,      -> { select('statuses.*, (select count(r.id) from statuses as r where r.reblog_of_id = statuses.id) as reblogs_count, (select count(f.id) from favourites as f where f.status_id = statuses.id) as favourites_count') }
   scope :with_includes,      -> { includes(:account, reblog: :account, thread: :account) }
-  scope :paginate_by_max_id, -> (limit, max_id) { order('id desc').limit(limit).where('id < ?', max_id) }
+  scope :paginate_by_max_id, -> (limit, max_id) { order('id desc').limit(limit).where(max_id.nil? ? '1=1' : ['id < ?', max_id]) }
 
   def local?
     self.uri.nil?