最も簡単ですが、やりたいことによっては制限があるかもしれません。
実行可能ですが、より複雑になります。TopicQuery がリストを実装する方法 を確認してください。
そして特に
def list_hot
create_list(:hot, unordered: true, prioritize_pinned: true) do |topics|
topics = remove_muted(topics, user, options)
topics.joins("JOIN topic_hot_scores on topics.id = topic_hot_scores.topic_id").order(
"topic_hot_scores.score DESC",
)
end
end
追加するのは比較的簡単ですが、考慮すべき動く部分がかなりあります。私はこれを私の ‘homepage-filter’ プラグインで行い、それは良い出発点になるかもしれません。