Commit ec269be04a18ff28c85cd98dfa5d10cb3da5cb53
Committed by
GitHub
1 parent
18477e2f
Exists in
master
and in
14 other branches
Fix argument error when passing refresh to reindex (#1367)
`reindex_scope` function that is called in the else block of `reindex` raises an argument error exception when `refresh` option is passed on. This commit makes sure it is removed from the options.
Showing
2 changed files
with
5 additions
and
0 deletions
Show diff stats
lib/searchkick/index.rb
@@ -184,6 +184,7 @@ module Searchkick | @@ -184,6 +184,7 @@ module Searchkick | ||
184 | 184 | ||
185 | def reindex(relation, method_name, scoped:, full: false, scope: nil, **options) | 185 | def reindex(relation, method_name, scoped:, full: false, scope: nil, **options) |
186 | refresh = options.fetch(:refresh, !scoped) | 186 | refresh = options.fetch(:refresh, !scoped) |
187 | + options.delete(:refresh) | ||
187 | 188 | ||
188 | if method_name | 189 | if method_name |
189 | # update | 190 | # update |
test/reindex_test.rb
@@ -88,4 +88,8 @@ class ReindexTest < Minitest::Test | @@ -88,4 +88,8 @@ class ReindexTest < Minitest::Test | ||
88 | def test_resume | 88 | def test_resume |
89 | assert Product.reindex(resume: true) | 89 | assert Product.reindex(resume: true) |
90 | end | 90 | end |
91 | + | ||
92 | + def test_full_reindex | ||
93 | + Product.reindex(refresh: true) | ||
94 | + end | ||
91 | end | 95 | end |