Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This will give you a list of sessions that were last updated within the last 10 minutes, and have user id's
- #
- # All thats left is to make a before filter and touch on the session data in some way so it gets updated in the db.
- sessions = CGI::Session::ActiveRecordStore::Session.find(:all, :conditions => {:updated_at => (Time.now-10.minutes..Time.now) } )
- uids = sessions.collect{|session| session.data[:user]}.compact.uniq
- active_users = User.find(uids).collect(&:username)
Add Comment
Please, Sign In to add comment