better online user list

This commit is contained in:
jomo
2014-06-29 06:45:00 +02:00
parent ed2feab298
commit b276d93822
2 changed files with 6 additions and 2 deletions

View File

@@ -39,8 +39,12 @@ class User < ActiveRecord::Base
!!self.confirmed
end
def self.seen(time)
# when you change this, change footer.html.erb as well?
User.where("last_seen >= ?", time.ago).order("last_seen, desc")
end
def online?
# when you change this, change footer.html.erb as well!
last_seen && last_seen > 2.minutes.ago
end