module ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting

def escape_bytea(value)

Escapes binary strings for bytea input to the database.
def escape_bytea(value)
  @connection.escape_bytea(value) if value
end