mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 16:19:52 +01:00
16 lines
410 B
Ruby
16 lines
410 B
Ruby
# frozen_string_literal: true
|
|
|
|
module User::AnswerMethods
|
|
include CursorPaginatable
|
|
|
|
define_cursor_paginator :cursored_answers, :ordered_answers
|
|
|
|
# @return [ActiveRecord::Relation<Answer>] List of a user's answers
|
|
def ordered_answers(current_user_id:)
|
|
answers
|
|
.for_user(current_user_id)
|
|
.order(:created_at)
|
|
.reverse_order
|
|
.includes(question: { user: [:profile] })
|
|
end
|
|
end
|