Guest User

Untitled

a guest
Jun 24th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. class Person < ActiveRecord::Base
  2.  
  3. def self.online
  4. find(:all, :conditions => [ 'updated_at >= ?', 30.seconds.ago ])
  5. end
  6.  
  7. has_one :login
  8.  
  9. def online?
  10. updated_at >= 30.seconds.ago
  11. end
  12.  
  13. def touch
  14. update_attribute(:updated_at, Time.now)
  15. end
  16.  
  17. end
Add Comment
Please, Sign In to add comment