module Mongoid::Uuid::Uuid

Private Instance Methods

generate_uuid() click to toggle source

Sets unique UUID unless uuid is present.

# File lib/mongoid/uuid/uuid.rb, line 21
def generate_uuid
  self.uuid = BSON::Binary.new(SecureRandom.uuid, :uuid) if uuid.to_s.empty?
end