Module: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::ByteaDecodeDetection

Included in:
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
Defined in:
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#unescape_bytea(string) ⇒ Object



1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
# File 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb', line 1287

def unescape_bytea(string)
  if string.instance_variable_get(:@ar_pg_bytea_decoded) == true
    ActiveRecord.deprecator.warn("      unescape_bytea called on a query result value that has already been\n      automatically unescaped due to `config.active_record.postgresql_adapter_decode_bytea`.\n      In a future Rails release, this will double-unescape the value as\n      instructed, which could cause data corruption.\n    MSG\n\n    result = string.dup\n    result.remove_instance_variable(:@ar_pg_bytea_decoded)\n    return result\n  end\n\n  super\nend\n".squish)