ActiveRecord::Type::Uuid#hex
to make it easier to convert when we have to look in the logs
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user