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?
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.
Join 30,005+ developers who get early access to new screencasts, articles, guides, updates, and more.