]> git.openstreetmap.org Git - rails.git/blob - app/models/user_token.rb
jsrouting: clear search boxes on page unload
[rails.git] / app / models / user_token.rb
1 class UserToken < ActiveRecord::Base
2   belongs_to :user
3
4   after_initialize :set_defaults
5
6   def expired?
7     expiry < Time.now
8   end
9
10 private
11
12   def set_defaults
13     self.token = OSM::make_token() if self.token.blank?
14     self.expiry = 1.week.from_now if self.expiry.blank?
15   end
16 end