Ask A Question

Notifications

You’re not receiving notifications from this thread.

how do implement a rails popularity/trending algorithm!!

AustinLan asked in General
  • I'm making a web app and I want to sort through a model based on popularity/trendiness, kind of like reddit/hacker news. 192.168.0.1 I want to determine the popularity based on the count of comments, likes, and impression divided by the creation date from the whatsapp web
Reply

Here's a gist that contains Reddit's popularity algorithm that you could use. It's pretty simple and just uses upvote, but you could add in comments and impressions to the calculation too. https://gist.github.com/nanosplit/db42e507c5d1d984b664868db10a3669

This is another approach that you should check out. https://www.akitaonrails.com/2016/10/31/ruby-on-rails-implementation-of-a-proper-ranking-popularity-system

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 76,990+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.