0
乾杯!我有tour
模型與這些協會:Ruby on Rails思維獅身人面像有許多通過索引
has_many :tour_in_the_countries
has_many :country, :through => :tour_in_the_countries
而且在tour_index.rb
ThinkingSphinx::Index.define :tour, :with => :active_record do
indexes :title
indexes :preview
end
如何添加到索引的國名在這種情況下?
另外:我會親自命名'的has_many:國...''到的has_many:國家...' - Rails是一個足夠聰明,拿起你的意思TourInTheCountry上的國家協會 – pat 2013-04-05 10:07:57
它的確如此,謝謝。哦,那只是一個錯字。 – xamenrax 2013-04-05 10:12:56
對不起,我建立了索引,儘管一切正常,但是當我嘗試搜索:'Tour.search:conditions => {:countries =>'Australia'}'時,它返回了no_method錯誤,並帶有未定義的方法條件= for#' –
xamenrax
2013-04-05 13:56:08