ruby-on-railsrubyruby-on-rails-4sphinxthinking-sphinx

How to include associations in thinking sphinx rails


Using thinking-sphinx to fetch records and it works fine. But the issue is that I want to fetch associated records also in results to improve site performance.

Like I want to fetch pictures of articles also along with articles .

Tried this one but its not working

 Article.search :include => [:pictures]

How can I do that?


Solution

  • Since Thinking Sphinx v3, the :include option is now within the :sql option:

    Article.search :sql => {:include => :pictures}