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:
+1
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user