3
我正在使用elasticsearch在我的應用程序中進行查詢。比方說,有2種型號輪胎:渴望從多個模型加載關聯
Class Topic
has_many :posts
和
Class Article
has_many :comments
我想要做這兩種模式的組合搜索和我的查詢看起來像:
Tire.search [Article, Topic], {:load => {:include => [:posts, :comments]}} do |search|
...
end
這是我遇到的一個問題。我得到了
Association named comments not found
錯誤。我認爲這是因爲Topic模型沒有關聯評論,我認爲文章模型的帖子也會發生同樣的情況。
有沒有辦法解決這個問題?我在想也許像
:include => ['topic.posts', 'article.comments']
請幫我。
我用過。對不起,沒有發佈答案。和FYI,這就是我所說的:https://github.com/karmi/retire/issues/762 –