views:

28

answers:

1

Hello, 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!

+1  A: 

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