blob: 5e839228e9fa07cdc77f0462b39bd218ede49481 (
plain) (
tree)
|
|
module ActiveRecord
module ConnectionAdapters
module PostgreSQL
module OID # :nodoc:
class Uuid < Type::Value # :nodoc:
ACCEPTABLE_UUID = %r{\A\{?([a-fA-F0-9]{4}-?){8}\}?\z}x
alias_method :serialize, :deserialize
def type
:uuid
end
def cast(value)
value.to_s[ACCEPTABLE_UUID, 0]
end
end
end
end
end
end
|