This method is deprecated or moved on the latest stable version.
The last existing version (v2.1.0) is shown here.
string_to_binary(value)
private
Escapes binary strings for bytea input to the database.
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 64
def self.string_to_binary(value)
if PGconn.respond_to?(:escape_bytea)
self.class.module_eval do
define_method(:string_to_binary) do |value|
PGconn.escape_bytea(value) if value
end
end
else
self.class.module_eval do
define_method(:string_to_binary) do |value|
if value
result = ''
value.each_byte { |c| result << sprintf('\\\\%03o', c) }
result
end
end
end
end
self.class.string_to_binary(value)
end