We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a88cc5c commit 8beb899Copy full SHA for 8beb899
2 files changed
app/controllers/application_controller.rb
@@ -261,7 +261,7 @@ def pull_pinned_links_and_hot_questions
261
end
262
263
# eager loading revived collections' used relation to prevent N+1 queries
264
- @pinned_links = @pinned_links.includes(post: [:community])
+ @pinned_links = @pinned_links.list_includes
265
@hot_questions = @hot_questions.list_includes
266
267
app/models/pinned_link.rb
@@ -2,6 +2,10 @@ class PinnedLink < ApplicationRecord
2
include MaybeCommunityRelated
3
belongs_to :post, optional: true
4
5
+ scope :list_includes, lambda {
6
+ includes(:post, post: [:community])
7
+ }
8
+
9
validate :check_post_or_url
10
11
# Is the link time-constrained?
0 commit comments