Is there a way to figure out how many users are actively logged into a rails app using devise?
Rails 3.1
gem \'devise\', \'~> 1.4\' gem \'dm
Since all of the information related to being logged in is handled in the session, there's no simple way out of the box. I would recommend doing something in ApplicationController to manage this information.
We use a before_filter in a number of our applications to track very specific information about each page request. You could do something similar to track what page they hit, when they hit it, and who they were.
Then determining logged in users would be as simple as determining how long ago their last page load would have to be for them to count as logged in, then select on your table of views based on that. Something like
MyPageView.select(["DISTINCT user WHERE created_at > ?", my_threshold_time]) would give you the distinct users.