Topic: undefined method `all_text_fields' for nil:NilClass

hello
         i am developing on rails application for searching  that i am using sunspot search,problem is sunspot server is running properly but at the searching time when i search for one word it is showing some error like

Re: undefined method `all_text_fields' for nil:NilClass

its very urgent