Hey,
I’m using this to see who’s online on a intranet site at work.
def get_online_users
sessions = CGI::Session::ActiveRecordStore::Session.find(:all,
:conditions => [“updated_at >= ?”, 30.minutes.ago])
user_ids = sessions.collect{|s| s.data[:user_id]}.compact.uniq
online_users = User.find(user_ids, :select => “screen_name”)
return online_users
end
It all works fine and returns a list of who is online at any given
time(with 30mins delay)
Now I’d like to show a “online now” badge on the actual user profile,
how could I compare this online_user object to see if a given user is
present in this online_user object?
Pretty basic I suppose but I’m only a noob!
Thank you
Oli