ActiveRecord::Type::Uuid#hex

to make it easier to convert when we have to look in the logs
This commit is contained in:
Mike Dalessio
2025-11-17 20:04:43 -05:00
parent 5964431fc4
commit d8f935498a
+5 -2
View File
@@ -17,11 +17,14 @@ module ActiveRecord
def serialize(value)
return unless value
hex = value.to_s.to_i(36).to_s(16).rjust(32, "0")
binary = hex.scan(/../).map(&:hex).pack("C*")
binary = hex(value).scan(/../).map(&:hex).pack("C*")
super(binary)
end
def hex(value)
value.to_s.to_i(36).to_s(16).rjust(32, "0")
end
def deserialize(value)
return unless value