diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index eb4578886..676091a18 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -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 diff --git a/config/environments/development.rb b/config/environments/development.rb index 2c75b9349..ad791414c 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -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) diff --git a/config/environments/test.rb b/config/environments/test.rb index cbcd1f520..4e66cca7a 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -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)