Commit 0d3b9389a1e4bc23d2cccd7b7c63c6d912e782e5
1 parent
0c8f25ca
Exists in
master
and in
2 other branches
Revert "Moved logic [skip ci]"
This reverts commit 6a20738383578a4128d3ef649b50b77d7d918129.
Showing
2 changed files
with
4 additions
and
4 deletions
Show diff stats
lib/searchkick.rb
@@ -140,10 +140,6 @@ module Searchkick | @@ -140,10 +140,6 @@ module Searchkick | ||
140 | end | 140 | end |
141 | 141 | ||
142 | def self.search(term = "*", model: nil, **options, &block) | 142 | def self.search(term = "*", model: nil, **options, &block) |
143 | - if relation?(model) | ||
144 | - raise Error, "search must be called on model, not relation" | ||
145 | - end | ||
146 | - | ||
147 | options = options.dup | 143 | options = options.dup |
148 | klass = model | 144 | klass = model |
149 | 145 |
lib/searchkick/model.rb
@@ -55,6 +55,10 @@ module Searchkick | @@ -55,6 +55,10 @@ module Searchkick | ||
55 | 55 | ||
56 | class << self | 56 | class << self |
57 | def searchkick_search(term = "*", **options, &block) | 57 | def searchkick_search(term = "*", **options, &block) |
58 | + if Searchkick.relation?(self) | ||
59 | + raise Searchkick::Error, "search must be called on model, not relation" | ||
60 | + end | ||
61 | + | ||
58 | Searchkick.search(term, model: self, **options, &block) | 62 | Searchkick.search(term, model: self, **options, &block) |
59 | end | 63 | end |
60 | alias_method Searchkick.search_method_name, :searchkick_search if Searchkick.search_method_name | 64 | alias_method Searchkick.search_method_name, :searchkick_search if Searchkick.search_method_name |