Retrospring/app/models/user/question_methods.rb

15 lines
344 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module User::QuestionMethods
include CursorPaginatable
define_cursor_paginator :cursored_questions, :ordered_questions
2020-04-22 18:31:07 -07:00
def ordered_questions(author_is_anonymous: nil)
questions
2020-04-22 18:31:07 -07:00
.where({ author_is_anonymous: author_is_anonymous }.compact)
.order(:created_at)
.reverse_order
end
end