Sha256: 152acaf53ee6c1287d90eb50183a50fb924546a728b7373b2933e6f4fa4e7645

Contents?: true

Size: 265 Bytes

Versions: 2

Compression:

Stored size: 265 Bytes

Contents

module EasyTokens
  class Token < ActiveRecord::Base
    after_initialize :ensure_token_presence
    belongs_to :owner, class_name: EasyTokens.token_owner_class

    private

    def ensure_token_presence
      self.value ||= SecureRandom.hex(16)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
easy_tokens-0.4.0 app/models/easy_tokens/token.rb
easy_tokens-0.3.0 app/models/easy_tokens/token.rb