diff --git a/lib/searchkick/model.rb b/lib/searchkick/model.rb index b7b04c0..a4be03d 100644 --- a/lib/searchkick/model.rb +++ b/lib/searchkick/model.rb @@ -78,7 +78,7 @@ module Searchkick def searchkick_reindex(method_name = nil, **options) scoped = Searchkick.relation?(self) - relation = scoped ? all : searchkick_klass + relation = scoped ? all : searchkick_klass.all # prevent scope from affecting search_data unscoped do searchkick_index.reindex(relation, method_name, scoped: scoped, **options) diff --git a/test/reindex_test.rb b/test/reindex_test.rb index 03d20b4..f721090 100644 --- a/test/reindex_test.rb +++ b/test/reindex_test.rb @@ -185,6 +185,12 @@ class ReindexTest < Minitest::Test assert_match "unsupported keywords: :async", error.message end + def test_full_default_scope + store_names ["Test", "Test 2"], Band, reindex: false + Band.reindex + assert_search "*", ["Test"], {load: false}, Band + end + def test_callbacks_false Searchkick.callbacks(false) do store_names ["Product A", "Product B"] -- libgit2 0.21.0