appease our new robot overlords.

(I voted for Krang)
This commit is contained in:
Joseph Mastey
2017-12-12 21:00:45 -06:00
parent 4587a5ff67
commit bb863f5156
9 changed files with 34 additions and 32 deletions
+4 -3
View File
@@ -10,7 +10,7 @@ class User < ApplicationRecord
validates_presence_of :email
validates_uniqueness_of :email
validates_format_of :email, :with => /.+@.+\..+/i
validates_format_of :email, with: /.+@.+\..+/i
has_one :retirement, dependent: :destroy
has_one :paid_time_off, dependent: :destroy
@@ -57,9 +57,10 @@ class User < ApplicationRecord
end
def generate_token(column)
begin
loop do
self[column] = Encryption.encrypt_sensitive_value(self.id)
end while User.exists?(column => self[column])
break unless User.exists?(column => self[column])
end
self.save!
end