xamenrax
xamenrax

Reputation: 1744

Ruby on Rails thinking-sphinx has many through indexing

Cheers! I have tour model with these associations:

  has_many :tour_in_the_countries
  has_many :country, :through => :tour_in_the_countries

And in tour_index.rb

ThinkingSphinx::Index.define :tour, :with => :active_record do
  indexes :title
  indexes :preview
end

How to add to index country's name in this case?

Upvotes: 0

Views: 596

Answers (1)

pat
pat

Reputation: 16226

This should do the trick:

indexes tour_in_the_countries.country.name, :as => :countries

Upvotes: 2

Related Questions