Commit 0d3b9389a1e4bc23d2cccd7b7c63c6d912e782e5

Authored by Andrew Kane
1 parent 0c8f25ca

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 140 end
141 141  
142 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 143 options = options.dup
148 144 klass = model
149 145  
... ...
lib/searchkick/model.rb
... ... @@ -55,6 +55,10 @@ module Searchkick
55 55  
56 56 class << self
57 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 62 Searchkick.search(term, model: self, **options, &block)
59 63 end
60 64 alias_method Searchkick.search_method_name, :searchkick_search if Searchkick.search_method_name
... ...