简体   繁体   中英

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?

这应该做的伎俩:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM