Class: ULID::Rails::PostgresqlType

Inherits:
Type
  • Object
show all
Defined in:
lib/ulid/rails/postgresql_type.rb

Defined Under Namespace

Classes: Data

Instance Method Summary collapse

Methods inherited from Type

#assert_valid_value, #cast, #serialize

Instance Method Details

#deserialize(value) ⇒ Object

Inspired by active_record/connection_adapters/postgresql/oid/bytea



17
18
19
20
21
22
23
24
25
26
# File 'lib/ulid/rails/postgresql_type.rb', line 17

def deserialize(value)
  case value
  when nil
    nil
  when ULID::Rails::Type::Data
    super(value.value)
  else
    super(PG::Connection.unescape_bytea(value))
  end
end