Skip to main content
Ask A Question
You’re not receiving notifications from this thread.

how do implement a rails popularity/trending algorithm

Rails • Asked by Samuel Janes

I'm making a web app and I want to sort through a model based on popularity/trendiness, kind of like reddit/hacker news.
I want to determine the popularity based on the count of comments, likes, and impression divided by the creation date from the current world time, or some better algortihm.
How would I implement that

Hey Samuel, I haven't done this recently, but it's a fun one that I should definitely do a screencast on sometime.

Check out this post. He links to a couple other related posts that are worth reading and implements a SQL query to do ranking. You can probably do something similar to this:

If you haven't seen it already, check out the reddit "hot" algorithm

There's also a thread I found on reddit that talks about it and helps explain what it's doing:

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.