diff --git a/Gemfile b/Gemfile index f4732a95..bd58f0d4 100644 --- a/Gemfile +++ b/Gemfile @@ -74,6 +74,7 @@ group :development do gem "bullet" gem "hotwire-spark" gem "letter_opener" + gem "rack-mini-profiler" # Use console on exceptions pages [https://github.com/rails/web-console] gem "web-console" end diff --git a/Gemfile.lock b/Gemfile.lock index 506f7503..892cb9a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -309,6 +309,8 @@ GEM raabro (1.4.0) racc (1.8.1) rack (3.1.16) + rack-mini-profiler (4.0.0) + rack (>= 1.2.0) rack-session (2.1.1) base64 (>= 0.1.0) rack (>= 3.0.0) @@ -519,6 +521,7 @@ DEPENDENCIES pg (~> 1.1) propshaft puma (>= 5.0) + rack-mini-profiler rails (~> 8.0.1) rails-controller-testing requestjs-rails diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index 0017d7d6..8f514928 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -5,7 +5,7 @@ class TopicsController < ApplicationController before_action :set_topic, only: [ :show, :edit, :tags, :update, :destroy, :archive ] def index - @pagy, @topics = pagy(scope.search_with_params(search_params)) + @pagy, @topics = pagy(scope.includes(:documents_attachments).search_with_params(search_params)) @available_providers = other_available_providers @languages = scope.map(&:language).uniq.sort_by(&:name) end diff --git a/app/views/topics/_list.html.erb b/app/views/topics/_list.html.erb index 4e9a75ed..6e11e661 100644 --- a/app/views/topics/_list.html.erb +++ b/app/views/topics/_list.html.erb @@ -6,6 +6,7 @@