Commit bdb3a72274f475c6754dba888f7595d2c5b54c2e

Authored by Andrew Kane
1 parent 0dd5e6e9

Fixed searchkick:reindex:all rake task for Rails 6 - fixes #1301

Showing 2 changed files with 8 additions and 1 deletions   Show diff stats
CHANGELOG.md
... ... @@ -2,6 +2,7 @@
2 2  
3 3 - Added `chinese2` and `korean2` languages
4 4 - Improved performance of async full reindex
  5 +- Fixed `searchkick:reindex:all` rake task for Rails 6
5 6  
6 7 ## 4.1.0 (2019-08-01)
7 8  
... ...
lib/tasks/searchkick.rake
... ... @@ -16,7 +16,13 @@ namespace :searchkick do
16 16 namespace :reindex do
17 17 desc "reindex all models"
18 18 task all: :environment do
19   - Rails.application.eager_load!
  19 + if Rails.respond_to?(:autoloaders) && Rails.autoloaders.zeitwerk_enabled?
  20 + # fix for https://github.com/rails/rails/issues/37006
  21 + Zeitwerk::Loader.eager_load_all
  22 + else
  23 + Rails.application.eager_load!
  24 + end
  25 +
20 26 Searchkick.models.each do |model|
21 27 puts "Reindexing #{model.name}..."
22 28 model.reindex
... ...