3

I'm interested in learning how to implement a News Feed / Activity Feed on a web app for multiple models like Books, Authors, Comments, etc...

Any recommendations from the group? Gems/Plugins, or experience personally or from others on the best/smartest way to proceed?

Thanks!

AnApprentice
  • 108,152
  • 195
  • 629
  • 1,012
  • Previously: http://stackoverflow.com/questions/2242173/how-do-i-create-a-facebook-style-news-feed-in-ruby-on-rails/2247395#2247395 – Eric Sep 28 '10 at 05:54

2 Answers2

12

You don't need any Gem.

  1. Create a new model, e.g. Activity, to store activity details. The module should store at least the activity timestamp, the event (e.g. created, destroyed, published, ...) and the id of the related record (you can even use a polymorphic association if you want)
  2. Create a method which gets in input a record with additional metadata and creates a new activity record
  3. In you controllers, call the method each time you want to keep track of an action, passing the modified record as parameter

Then you'll have a list of Activity records you can easily fetch to display the latest events.

Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
  • That's how I'm handling it. I'm not sure how to handle bulk actions, though. For example, if a user changes the status of 10 tasks at the same time. We could create 10 activities, but ideally there should be some grouping for display purposes. It's annoying to see 20 "Mohamad marked x as complete" followed by each other. How do you handle that? – Mohamad May 27 '15 at 08:02
-2

First and foremost, I’d like to be open and say that I am an employee of Stream, an API for building scalable news and activity feeds – much like you would see on Facebook, Instagram, and other social media applications.

From my extensive experience as a developer and consultant and continued research and self-education, Stream’s technology stack is extremely effective or competitive. You can get a news or activity feed up and running in a fraction of the time than it would take you to build out your own infrastructure (Cassandra clusters, queuing mechanisms, etc.).

That being said, I highly recommend checking out Stream. What it really comes down to is buy vs build. You can spend months building out a custom solution, or rely on a proven and scalable platform such as Stream that will offer you everything you need to get up and going, in a fraction of the time.

If you're skeptical, check out the 5 minute tutorial at https://getstream.io/get_started/.

Best of luck!

Nick Parsons
  • 8,377
  • 13
  • 48
  • 70
  • Thanks for the link! However, it's quite uncomfortable when I have to register not sure this stuff is making what I need. You know I'm signing out each month from at least a pair of useless accounts. It would be nice if there was at least 1 min video. – Alexander Gorg Oct 02 '18 at 11:43