Retrospring/app/models/user/inbox_methods.rb

16 lines
346 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module User::InboxMethods
include CursorPaginatable
define_cursor_paginator :cursored_inbox, :ordered_inbox
2023-01-28 12:17:08 -08:00
# @return [ActiveRecord::Relation<Inbox>] the user's inbox entries
def ordered_inbox
inboxes
2023-01-28 12:17:08 -08:00
.includes(:question, user: :profile)
.order(:created_at)
.reverse_order
end
end