DEV Community

Discussion on: Using Rails secret weapon: ActiveSupport::Notifications

Collapse
 
andy profile image
Andy Zhao (he/him)

Hmm interesting! I'm thinking of ActiveSupport::Notifications for a notification system, but I wonder if it would eat up a lot of memory. I've been back and forth between whether or not it makes more sense to use something like ActiveSupport or have a database table specifically for the notifications.

Is there a way to render the payload data in a view? I'm guessing you could do something like:

class NotificationsController
  def index
    @notifications = ActiveSupport::Notifications::Event.all
   # or whatever the syntax is
  end
end
Enter fullscreen mode Exit fullscreen mode

Also I wonder if there's a way to expire events. Thanks for sharing this! Now my mind is brewing...