In dashboard show api eager load collection with articles (#14677)
* In dashboard show api eager load collection with articles * Dashboard Article Row view now loads collection to suppress bullet warning of eager loading
This commit is contained in:
parent
2a75ec8ecc
commit
c88f8dcdaa
3 changed files with 3 additions and 1 deletions
|
|
@ -23,7 +23,7 @@ class DashboardsController < ApplicationController
|
|||
@reactions_count = @articles.sum(&:public_reactions_count)
|
||||
@page_views_count = @articles.sum(&:page_views_count)
|
||||
|
||||
@articles = @articles.sorting(params[:sort]).decorate
|
||||
@articles = @articles.includes(:collection).sorting(params[:sort]).decorate
|
||||
@articles = Kaminari.paginate_array(@articles).page(params[:page]).per(50)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ Rails.application.configure do
|
|||
Bullet.add_safelist(type: :n_plus_one_query, class_name: "ActsAsTaggableOn::Tagging", association: :tag)
|
||||
# Supress incorrect warnings from Bullet due to included columns: https://github.com/flyerhzm/bullet/issues/147
|
||||
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Article", association: :top_comments)
|
||||
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Article", association: :collection)
|
||||
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Comment", association: :user)
|
||||
# NOTE: @citizen428 Temporarily ignoring this while working out user - profile relationship
|
||||
Bullet.add_safelist(type: :n_plus_one_query, class_name: "User", association: :profile)
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ Rails.application.configure do
|
|||
Bullet.add_safelist(type: :n_plus_one_query, class_name: "ActsAsTaggableOn::Tagging", association: :tag)
|
||||
# Supress incorrect warnings from Bullet due to included columns: https://github.com/flyerhzm/bullet/issues/147
|
||||
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Article", association: :top_comments)
|
||||
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Article", association: :collection)
|
||||
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Comment", association: :user)
|
||||
# @citizen428: We have not yet resolved all user - profile preloads related to profilge generalization
|
||||
Bullet.add_safelist(type: :n_plus_one_query, class_name: "User", association: :profile)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue