Commit 6a20738383578a4128d3ef649b50b77d7d918129

Authored by Andrew Kane
1 parent 06da4f3d

Moved logic [skip ci]

Showing 2 changed files with 4 additions and 4 deletions   Show diff stats
lib/searchkick.rb
... ... @@ -140,6 +140,10 @@ module Searchkick
140 140 end
141 141  
142 142 def self.search(term = "*", model: nil, **options, &block)
  143 + if Searchkick.relation?(model)
  144 + raise Error, "search must be called on model, not relation"
  145 + end
  146 +
143 147 options = options.dup
144 148 klass = model
145 149  
... ...
lib/searchkick/model.rb
... ... @@ -55,10 +55,6 @@ 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   -
62 58 Searchkick.search(term, model: self, **options, &block)
63 59 end
64 60 alias_method Searchkick.search_method_name, :searchkick_search if Searchkick.search_method_name
... ...