module Sequel::Plugins::Uuid::InstanceMethods
Public Instance Methods
_before_validation()
click to toggle source
Calls superclass method
# File lib/sequel/plugins/uuid.rb, line 41 def _before_validation set_uuids if new? super end
generate_uuid()
click to toggle source
# File lib/sequel/plugins/uuid.rb, line 53 def generate_uuid orig = SecureRandom.uuid if model.uuid_prefix model.uuid_prefix.chars.each_with_index do |c, i| orig[i] = c end end orig end
set_uuids()
click to toggle source
# File lib/sequel/plugins/uuid.rb, line 46 def set_uuids model.uuid_fields.each do |field| meth = :"#{field}=" send(meth, generate_uuid) if respond_to?(meth) end end