modify generate auth token method

This commit is contained in:
Zin Moe
2020-01-14 15:34:02 +06:30
parent 3f338f2073
commit 37ff82ae5d
2 changed files with 24 additions and 22 deletions

View File

@@ -100,5 +100,7 @@ class Employee < ApplicationRecord
def generate_auth_token
return if self.role != 'app'
self.auth_token = SecureRandom.hex(10)
rescue ActiveRecord::RecordNotUnique
retry
end
end