Sha256: 3cc49680285c808e35f81db96fa8b23c250be09907df5b2816bdd4e38104ab33
Contents?: true
Size: 744 Bytes
Versions: 17
Compression:
Stored size: 744 Bytes
Contents
# == Schema Information # # Table name: notee_tokens # # id :integer not null, primary key # access_token :string not null # expires_at :datetime not null # created_at :datetime not null # updated_at :datetime not null # module Notee class Token < ActiveRecord::Base # callbacks before_create :generate_access_token before_create :set_expires_at # relations belongs_to :user private def generate_access_token begin self.access_token = SecureRandom.hex end while self.class.exists?(access_token: access_token) end def set_expires_at self.expires_at = Time.current + (60 * 60 * 24 * 7) # 7 days end end end
Version data entries
17 entries across 17 versions & 1 rubygems