1 # == Schema Information
3 # Table name: user_tokens
5 # id :bigint(8) not null, primary key
6 # user_id :bigint(8) not null
7 # token :string not null
8 # expiry :datetime not null
13 # user_tokens_token_idx (token) UNIQUE
14 # user_tokens_user_id_idx (user_id)
18 # user_tokens_user_id_fkey (user_id => users.id)
21 class UserToken < ApplicationRecord
24 after_initialize :set_defaults
33 self.token = OSM.make_token if token.blank?
34 self.expiry = 1.week.from_now if expiry.blank?