From d8f935498aa993c36e2aaa030bf8307b6ea90be4 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Mon, 17 Nov 2025 20:04:43 -0500 Subject: [PATCH] ActiveRecord::Type::Uuid#hex to make it easier to convert when we have to look in the logs --- lib/rails_ext/active_record_uuid_type.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/rails_ext/active_record_uuid_type.rb b/lib/rails_ext/active_record_uuid_type.rb index 6ac0ea801..3aca09762 100644 --- a/lib/rails_ext/active_record_uuid_type.rb +++ b/lib/rails_ext/active_record_uuid_type.rb @@ -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