undefined method `sphinx_facets' for nil:NilClass

I am getting
A NoMethodError occurred in main#search:

undefined method `sphinx_facets’ for nil:NilClass
[RAILS_ROOT]/vendor/plugins/

thinking-sphinx/lib/thinking_sphinx/facet_search.rb:131:in `facet_from_object’

Its occur in special scenerio…
Can any body tell me when and how to resolve this exception??

Thanks

  1. Make sure you don’t get nil values

  2. If nil values can’t be avoided, check for nil and don’t call sphinx_facets on it.

Best regards

Peter De Berdt