Skip to main content
Ask A Question
You’re not receiving notifications from this thread.

Could you do a screencast on how to build notifications with Rails?

General • Asked by Ken Hibino

I've been trying to add a notification system (bell icon on the header) to the app I'm building. The implementation I came up with is very awkward and I'm sure there's a better way to do it (maybe using a background job?). Could you do a quick screencast on how to build a notification system with Rails? I'd like to see how you would go about building one!

Yes! Definitely an awesome topic to cover. Quick outline of what it would look like:

class Notification < ActiveRecord::Base
  belongs_to :user
  def mark_as_read

You can look up the unread notifications for the nav, and send over an AJAX request to the Rails app to mark all those as read.

Hopefully able to do a screencast on this soon!

Thank you Chris! Definitely looking forward to the screencast :)

on the notifications system.

Would also be interested in seeing how it'd tie into for example emailing a user the notification as well as adding it to their feed. Would you want to make it so that if you click the link to a forum post in the email it'd mark that notification as read? How could this be done efficiently?

Yeah, you could probably do a special route to the notification. It would mark as read and then redirect you to the actual item in the notification. Either that, or you could mark any notifications for the object loaded in the show actions.

Thank you so much Chris!! your the man!!

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 30,005+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.