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?
on 2009-06-04 22:59
on 2009-06-04 23:22
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.
on 2009-06-05 01:36
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.