Eager loading of record in params #147
Unanswered
Itachi-weasel
asked this question in
Q&A
Replies: 1 comment 1 reply
-
To eager load, pass in the ID of the associated record(s) to The N+1 is not a problem as long as you fragment cache when you render the notification. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there any way to eager load the record in params? It's generating N+1 queries when I display the last 10 unread notifications.
eg:
current_user.notifications.unread.order(id: :desc).limit(10)
N+1 queries are generated for each post i.e stored in the params
Beta Was this translation helpful? Give feedback.
All reactions