Sha256: fa2664e6e8a65980350473fac78dfaee4a49e0b1aa8ab278a731a933aece7224
Contents?: true
Size: 499 Bytes
Versions: 16
Compression:
Stored size: 499 Bytes
Contents
module Landable class AccessToken < ActiveRecord::Base include Landable::TableName belongs_to :author validates_presence_of :author_id validates_presence_of :expires_at before_validation do |token| token.expires_at ||= 8.hours.from_now end scope :fresh, -> { where('expires_at > ?', Time.zone.now) } scope :expired, -> { where('expires_at <= ?', Time.zone.now) } def refresh! update_column :expires_at, 8.hours.from_now end end end
Version data entries
16 entries across 16 versions & 1 rubygems