Skip to content

Instantly share code, notes, and snippets.

@bjensen
Forked from anonymous/online_users.rb
Created January 30, 2010 14:36
Show Gist options
  • Save bjensen/290573 to your computer and use it in GitHub Desktop.
Save bjensen/290573 to your computer and use it in GitHub Desktop.
module OnlineUsers
def count_online_users
User.count(:conditions => ["last_request_at > ?", 30.minutes.ago])
end
end
class User << ActiveRecord::Base
acts_as_authentic do |c|
c.logged_in_timeout 30.minutes
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment