Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Person < ActiveRecord::Base
- def self.online
- find(:all, :conditions => [ 'updated_at >= ?', 30.seconds.ago ])
- end
- has_one :login
- def online?
- updated_at >= 30.seconds.ago
- end
- def touch
- update_attribute(:updated_at, Time.now)
- end
- end
Add Comment
Please, Sign In to add comment