I'm afraid this is where we hit the limitations of Thinking Sphinx. As an alternative work-around, why not fork TS and use your version in your Gemfile? That way you can change all the search methods to be ts_search, and saves you rewriting the bulk of your site?
-- Pat On 24/06/2011, at 1:00 PM, UnConundrum wrote: > :( > > Unfortunately, it doesn't seem to be working that way. Lets say I > have a model called History and one called Contact. My only index > block in the entire project is in History. In the controller, I'm now > calling History.ts_search, and that search works fine. Unfortunately, > when I want to go to the contact page and do a search with a > Contact.search, and there is a self.search method in the Contact > model, I get the "Missing Attribute for Foreign Key" error generated > by TS (see below). I have no index block defined in Contact. It's > like TS is doing the global search when it should be doing a model > search. Before I added the ts_search, I was doing a History.search, > not a ThinkingSphinx.search, so it should have been looking at just > History. I can't understand why it's looking at Contact. Any ideas? > > > RuntimeError (Missing Attribute for Foreign Key intranet_id): > /Users/user/.rvm/gems/ruby-1.8.7-p302/gems/thinking-sphinx-1.4.4/lib/ > thinking_sphinx/active_record/has_many_association.rb:28:in > `attribute_for_foreign_key' > /Users/user/.rvm/gems/ruby-1.8.7-p302/gems/thinking-sphinx-1.4.4/lib/ > thinking_sphinx/active_record/has_many_association.rb:32:in > `default_filter' > /Users/user/.rvm/gems/ruby-1.8.7-p302/gems/thinking-sphinx-1.4.4/lib/ > thinking_sphinx/active_record/has_many_association.rb:7:in `search' > app/controllers/contacts_controller.rb:53:in `index' > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en. > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
