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?
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?
get_online_users.include?(some_user) (you'll need to make your :select
include the id column for this to work)
You could save yourself a database hit (and instantiating a user
object for each online user) by having a method that just returns the
user_ids. You could then do something like user_ids.include?
(some_user.id)