我想检索community_topics
包含or or or的所有search keyword
内容community_topics.title
community_topics.body
comments.body
但是下面的这段代码检索并显示了一堆两倍、三倍或更多!记录:(我只希望它们作为单个记录。我该怎么办?
@community_topics = CommunityTopic.joins(:community, :comment_threads).merge(Community.not_deleted).where('community_topics.title like ? OR community_topics.body like ? OR comments.body like ?', "%"+params[:search]+"%", "%"+params[:search]+"%", "%"+params[:search]+"%").order('last_active_at DESC').page(params[:page]).per(10)