Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do i implement a trending function like twitter or facebook on my rails app?

Earl Greenwood asked in General

I want to implement a trending function for last 24 hours hottest topic discuss or mentioned most in my website,i want to know is there anyway to implement this function in ruby on rails application?

Reply

Hey Earl,

What I would do is create an activity model, so you would keep track of the views, discussions, etc in a table, and then you can query for those within the last 24 hours and then count them up to determine which were the most active topics. You can query for the different types of activities and weigh some of those more than others (like comments might be more valuable than likes or something).

Does that make sense?

Here's a good article on how you could move that stuff into Postgres as a function: http://sorentwo.com/2013/12/30/let-postgres-do-the-work.html

I should definitely do a screencast on this stuff.

Reply
Join the discussion
Create an account Log in

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

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

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