diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb new file mode 100644 index 0000000000..6bd1b8ecae --- /dev/null +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb @@ -0,0 +1,15 @@ +module ActiveRecord + module ConnectionAdapters + module PostgreSQL + module OID # :nodoc: + class Bytea < Type::Binary # :nodoc: + def type_cast_from_database(value) + return if value.nil? + return value.to_s if value.is_a?(Type::Binary::Data) + PGconn.unescape_bytea(super) + end + end + end + end + end +end |