cirandas.net

ref: master

plugins/driven_signup/models/driven_signup_plugin/auth.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
class DrivenSignupPlugin::Auth < ApplicationRecord

  attr_accessible :name, :token

  belongs_to :environment

  validates_presence_of :environment
  validates_presence_of :token
  validates_uniqueness_of :token, scope: :environment_id

  def token
    self[:token] ||= SecureRandom.hex 16
  end

end