Sha256: 51009b9531a30c42281374abac36a6569d60d1ff6ec2f97cafae1b5c50f95b3b

Contents?: true

Size: 470 Bytes

Versions: 1

Compression:

Stored size: 470 Bytes

Contents

module Arcadex
  class Token < ActiveRecord::Base
  	before_validation :generate_hash, on: :create

		belongs_to :imageable, :polymorphic => true

    validates :imageable_id, presence: true
    validates :imageable_type, presence: true
    validates :auth_token, presence: true
    #This also needs to exist at the database level
    validates :auth_token, uniqueness: true

    def generate_hash
    	self.auth_token = ::Arcadex.generate_auth_token
    end	
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arcadex-1.0.1 app/models/arcadex/token.rb