Sha256: 6c4f9224b41a0e2741cfcf97d17437a45a3b2c8efb1be90d7332b32eb4a08f76

Contents?: true

Size: 396 Bytes

Versions: 49

Compression:

Stored size: 396 Bytes

Contents

module Adeia
  class Token < ActiveRecord::Base
    belongs_to :permission, foreign_key: :adeia_permission_id

    validates :permission, presence: true
    validates :exp_at, presence: true

    before_create :generate_token

    def is_valid?
      exp_at > Time.now && is_valid
    end

    private

    def generate_token
      self.token = SecureRandom.urlsafe_base64
    end
    
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
adeia-1.0.0 app/models/adeia/token.rb
adeia-0.15.4 app/models/adeia/token.rb
adeia-0.15.3 app/models/adeia/token.rb
adeia-0.15.2 app/models/adeia/token.rb
adeia-0.15.1 app/models/adeia/token.rb
adeia-0.15.0 app/models/adeia/token.rb
adeia-0.14.0 app/models/adeia/token.rb
adeia-0.13.1 app/models/adeia/token.rb
adeia-0.13.0 app/models/adeia/token.rb
adeia-0.12.0 app/models/adeia/token.rb
adeia-0.11.11 app/models/adeia/token.rb
adeia-0.11.10 app/models/adeia/token.rb
adeia-0.11.9 app/models/adeia/token.rb
adeia-0.11.8 app/models/adeia/token.rb
adeia-0.11.7 app/models/adeia/token.rb
adeia-0.11.6 app/models/adeia/token.rb
adeia-0.11.5 app/models/adeia/token.rb
adeia-0.11.4 app/models/adeia/token.rb
adeia-0.11.3 app/models/adeia/token.rb
adeia-0.11.2 app/models/adeia/token.rb