Commit 14f77607910df94b2e175b5d85da730cd366b73a

Authored by Andrew Kane
1 parent b5f8a89b

Updated default_scope behavior match Searchkick 5 [skip ci]

Showing 2 changed files with 7 additions and 1 deletions   Show diff stats
lib/searchkick/model.rb
... ... @@ -78,7 +78,7 @@ module Searchkick
78 78  
79 79 def searchkick_reindex(method_name = nil, **options)
80 80 scoped = Searchkick.relation?(self)
81   - relation = scoped ? all : searchkick_klass
  81 + relation = scoped ? all : searchkick_klass.all
82 82 # prevent scope from affecting search_data
83 83 unscoped do
84 84 searchkick_index.reindex(relation, method_name, scoped: scoped, **options)
... ...
test/reindex_test.rb
... ... @@ -185,6 +185,12 @@ class ReindexTest < Minitest::Test
185 185 assert_match "unsupported keywords: :async", error.message
186 186 end
187 187  
  188 + def test_full_default_scope
  189 + store_names ["Test", "Test 2"], Band, reindex: false
  190 + Band.reindex
  191 + assert_search "*", ["Test"], {load: false}, Band
  192 + end
  193 +
188 194 def test_callbacks_false
189 195 Searchkick.callbacks(false) do
190 196 store_names ["Product A", "Product B"]
... ...