mirror of
https://github.com/apigy/selfstarter.git
synced 2026-01-08 22:07:56 -05:00
wrapped uuid builder into begin/while block to prevent accidental uuid duplication
This commit is contained in:
@@ -42,7 +42,9 @@ class Order < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def generate_uuid!
|
||||
self.uuid = SecureRandom.hex(16)
|
||||
begin
|
||||
self.uuid = SecureRandom.hex(16)
|
||||
end while Order.find_by_uuid(self.uuid).present?
|
||||
end
|
||||
|
||||
# Implement these three methods to
|
||||
|
||||
Reference in New Issue
Block a user