# Suggestions for notifying user on changes?

**URL:** <https://www.ruby-forum.com/t/suggestions-for-notifying-user-on-changes/169533>\
**Category:** Rails\
**Created:** [June 4, 2009, 10:59pm UTC](https://www.ruby-forum.com/t/suggestions-for-notifying-user-on-changes/169533 "2009-06-04T22:59:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![carl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@carl](https://www.ruby-forum.com/u/carl)\
**Post date:** [June 4, 2009, 10:59pm UTC](https://www.ruby-forum.com/t/suggestions-for-notifying-user-on-changes/169533/1 "2009-06-04T22:59:12Z")

</div>

I’m working on an app for collectively writing stories and I have most  
of the basic functions done. Users can create Universes that act as  
containers for Characters, Locations, and Events. Characters have  
Experiences of those Events. Universes start out completely private,  
but the creator can grant three levels of access to other users. I  
keep track of who created a Universe, who create a resource within  
that universe, and who last made changes to that resource.

I would like to have some way to notify users of what has changed  
since they last logged in. What records have changed, etc. I thought  
about going the email route, but I don’t think I want to do that since  
many small changes could cause many emails to be sent for the same  
thing, though eventually this might be the best choice. I’m thinking  
about maybe making a model that belongs to :user, that keeps track of  
changes, and using Observers to update the table. But I’m not really  
sure of the best way to do this. I could probably set up a cron job to  
crawl that table once a day and send emails to each user, that way I  
don’t have multiple emails per user per day. I wonder what systems  
have other people used and what pitfalls have you run into?

---

<div class="post-metadata">

**Author:** ![carl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@carl](https://www.ruby-forum.com/u/carl)\
**Post date:** [June 4, 2009, 11:22pm UTC](https://www.ruby-forum.com/t/suggestions-for-notifying-user-on-changes/169533/2 "2009-06-04T23:22:18Z")

</div>

The first paragraph is a great idea!

The second is terrible! Using a cron job is almost as silly as emailing  
(but not quite, at least you will be keeping your silliness to  
yourself).

Why don’t you just collect all this information when they next log in?  
If you have timestamps for all events, including logging in and out, you  
just compile a little “digest” of events that have occurred since the  
last log in, and then the user is free to examine that at their leisure.

---

<div class="post-metadata">

**Author:** ![carl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@carl](https://www.ruby-forum.com/u/carl)\
**Post date:** [June 5, 2009, 1:36am UTC](https://www.ruby-forum.com/t/suggestions-for-notifying-user-on-changes/169533/3 "2009-06-05T01:36:10Z")

</div>

What I meant by the second is the same way digests are sent out here.  
Rather than an email per incident, you’d get at most one per day that  
lists changes since the prior day.

That is true, I do have a created at and updated at time for each  
thing, so I could highlight those that are new since the last logon.  
But I’d have to keep track of what they have seen and what they  
haven’t, since if they go into one Universe and fiddle around for a  
bit they may not have actually seen everything there by the time they  
log out, nor seen anything in the other Universes they have access to  
or have created.
