Permalink
Browse files

wrapped uuid builder into begin/while block to prevent accidental uui…

…d duplication
  • Loading branch information...
1 parent 9c0827d commit d4c39d59a3f47fd755fdf62efceecac174b64255 @acuppy acuppy committed Nov 4, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 app/models/order.rb
View
@@ -42,7 +42,9 @@ def self.next_order_number
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

0 comments on commit d4c39d5

Please sign in to comment.