在以下 Sunspot Rails 场景中,尽管有 include 指令,但没有加载 has_and_belongs_to_many 关联:
has_and_belongs_to_many :predecessors, :join_table => 'next_phrases', :class_name => "Phrase", :foreign_key => 'next_id', :association_foreign_key => 'previous_id'
searchable :include =>[:predecessors] do
integer :predecessor_ids, :multiple => true,:references => Phrase
end
我们做错了什么还是这是一个错误?
如果我们手动调用 self.association(:predecessors).reload 它确实有效