mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-19 03:06:03 +01:00
Eager load notification targets
This commit is contained in:
parent
80e312eb3b
commit
40f7f8f525
1 changed files with 2 additions and 2 deletions
|
@ -11,11 +11,11 @@ class Notification < ApplicationRecord
|
|||
define_cursor_paginator :cursored_for_type, :for_type
|
||||
|
||||
def for(recipient, **kwargs)
|
||||
where(kwargs.merge!(recipient:)).order(:created_at).reverse_order
|
||||
where(kwargs.merge!(recipient:)).includes(:target).order(:created_at).reverse_order
|
||||
end
|
||||
|
||||
def for_type(recipient, type, **kwargs)
|
||||
where(kwargs.merge!(recipient:)).where(type:).order(:created_at).reverse_order
|
||||
where(kwargs.merge!(recipient:)).includes(:target).where(type:).order(:created_at).reverse_order
|
||||
end
|
||||
|
||||
def notify(recipient, target)
|
||||
|
|
Loading…
Reference in a new issue