You could create a logged-in users table, log their user id an IP. Also their session ID?
When users log in, check to make sure their user ID isn't in the table, then write their connection to the table.
When they log out, delete the entry.
But what if they just disconnect and don't log out? You'll need to do some sort of housekeeping every so often on sessions/logged connections. I've not tackled this problem yet, but you'd probably have to do it from a cron job. I have several rails tasks that run only from cron and it works very well.
Let me know what you come up with
Narayana Karthick wrote: