Undefined method `all_text_fields' for nil: NilClass

I use Rails 2.1 and implement Sunspot search. The server is working fine, but the problem is that when I search for text, it shows this error:

undefined method `all_text_fields' for nil:NilClass

Can anyone find out about a solution to this problem, please help me?

Thank.

+3
source share
1 answer

This is most likely a mistake emanating from the gem of a sunspot. This can happen if your model is not configured correctly. Do you have a searchable block in the model on which you are trying to run a search?

eg:.

class Foo > ActiveRecord::Base
  searchable do
    integer :size
  end
end
+1
source

Source: https://habr.com/ru/post/1772611/


All Articles