I'm using Rails 3.2 and Thinking Sphinx 3. I have the following associated models:
# country.rb
class Country < ActiveRecord::Base
has_many :states
end
# state.rb
class State < ActiveRecord::Base
belongs_to :country
has_many :state_shops
has_many :shops, :through => :state_shops
end
# state_shop.rb
class StateShop < ActiveRecord::Base
belongs_to :state
belongs_to :shop
end
# shop.rb
class Shop < ActiveRecord::Base
end
In country.rb, I wanna search the name of shop. Here is my index for country:
# country_index.rb
ThinkingSphinx::Index.define :country, :with => :active_record do
indexes :name
has budget, duration, overall_rating, created_at
end
How should my associated index be in order to search the shop.name?