Merge pull request #2169 from basecamp/flavorjones/better-hex-uuid

Extract `hex_to_base36` and `base36_to_hex` methods in `Uuid` type
This commit is contained in:
Mike Dalessio
2025-12-19 10:06:36 -05:00
committed by GitHub
2 changed files with 16 additions and 15 deletions
+1 -2
View File
@@ -154,8 +154,7 @@ module FixturesTestHelper
# Format as UUID string and convert to base36 (25 chars)
uuid = "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" % bytes
hex = uuid.delete("-")
hex.to_i(16).to_s(36).rjust(25, "0")
ActiveRecord::Type::Uuid.hex_to_base36(uuid.delete("-"))
end
end
end