Commit bdb3a72274f475c6754dba888f7595d2c5b54c2e
1 parent
0dd5e6e9
Exists in
master
and in
15 other branches
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
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 | ... | ... |