This commit is contained in:
@@ -6,14 +6,10 @@ class PostsController < ApplicationController
|
||||
# GET /posts
|
||||
def index
|
||||
limit = (params[:limit] || 20).to_i
|
||||
cursor = params[:cursor]
|
||||
cursor = params[:cursor].presence
|
||||
|
||||
q = filtered_posts.order(created_at: :desc)
|
||||
|
||||
next_cursor = nil
|
||||
if cursor.present?
|
||||
q = q.where('posts.created_at < ?', Time.iso8601(cursor))
|
||||
end
|
||||
q = q.where('posts.created_at < ?', Time.iso8601(cursor)) if cursor
|
||||
|
||||
posts = q.limit(limit + 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user