diff --git a/lib/searchkick.rb b/lib/searchkick.rb index 5f2babd..df39b68 100644 --- a/lib/searchkick.rb +++ b/lib/searchkick.rb @@ -140,6 +140,10 @@ module Searchkick end def self.search(term = "*", model: nil, **options, &block) + if Searchkick.relation?(model) + raise Error, "search must be called on model, not relation" + end + options = options.dup klass = model diff --git a/lib/searchkick/model.rb b/lib/searchkick/model.rb index c88f6c5..0020809 100644 --- a/lib/searchkick/model.rb +++ b/lib/searchkick/model.rb @@ -55,10 +55,6 @@ module Searchkick class << self def searchkick_search(term = "*", **options, &block) - if Searchkick.relation?(self) - raise Searchkick::Error, "search must be called on model, not relation" - end - Searchkick.search(term, model: self, **options, &block) end alias_method Searchkick.search_method_name, :searchkick_search if Searchkick.search_method_name -- libgit2 0.21.0