mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 16:19:52 +01:00
15 lines
428 B
Ruby
15 lines
428 B
Ruby
# frozen_string_literal: true
|
|
|
|
module User::QuestionMethods
|
|
include CursorPaginatable
|
|
|
|
define_cursor_paginator :cursored_questions, :ordered_questions
|
|
|
|
# @return [ActiveRecord::Relation<Question>] List of questions sent by the user
|
|
def ordered_questions(author_is_anonymous: nil, direct: nil)
|
|
questions
|
|
.where({ author_is_anonymous:, direct: }.compact)
|
|
.order(:created_at)
|
|
.reverse_order
|
|
end
|
|
end
|