Retrospring/app/models/user/question_methods.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

16 lines
428 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module User::QuestionMethods
include CursorPaginatable
define_cursor_paginator :cursored_questions, :ordered_questions
2023-01-28 12:17:25 -08:00
# @return [ActiveRecord::Relation<Question>] List of questions sent by the user
def ordered_questions(author_is_anonymous: nil, direct: nil)
questions
2022-07-24 13:27:15 -07:00
.where({ author_is_anonymous:, direct: }.compact)
.order(:created_at)
.reverse_order
end
end