Retrospring/app/models/user/timeline_methods.rb

13 lines
404 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module User::TimelineMethods
include CursorPaginatable
define_cursor_paginator :cursored_timeline, :timeline
# @return [Array] the users' timeline
def timeline
2021-12-31 13:19:21 -08:00
Answer.where('user_id in (?) OR user_id = ?', following_ids, id).order(:created_at).reverse_order.includes(comments: [:user, :smiles], question: [:user], user: [:profile], smiles: [:user])
end
end