Commit 6faac6b71de1d1e7f40d2f297b9e165337708c1d
1 parent
90c88126
Exists in
master
and in
2 other branches
DRY code [skip ci]
Showing
1 changed file
with
2 additions
and
9 deletions
Show diff stats
lib/searchkick/index.rb
... | ... | @@ -199,20 +199,13 @@ module Searchkick |
199 | 199 | refresh = options.fetch(:refresh, !scoped) |
200 | 200 | options.delete(:refresh) |
201 | 201 | |
202 | - if method_name | |
202 | + if method_name || (scoped && !full) | |
203 | 203 | raise ArgumentError, "unsupported keywords: #{options.keys.map(&:inspect).join(", ")}" if options.any? |
204 | 204 | |
205 | - # update | |
205 | + # import only | |
206 | 206 | import_scope(relation, method_name: method_name, scope: scope) |
207 | 207 | self.refresh if refresh |
208 | 208 | true |
209 | - elsif scoped && !full | |
210 | - raise ArgumentError, "unsupported keywords: #{options.keys.map(&:inspect).join(", ")}" if options.any? | |
211 | - | |
212 | - # reindex association | |
213 | - import_scope(relation, scope: scope) | |
214 | - self.refresh if refresh | |
215 | - true | |
216 | 209 | else |
217 | 210 | # full reindex |
218 | 211 | reindex_scope(relation, scope: scope, **options) | ... | ... |