lib/rubyrep/connection_extenders/postgresql_extender.rb in rubyrep-2.0.0 vs lib/rubyrep/connection_extenders/postgresql_extender.rb in rubyrep-2.0.1
- old
+ new
@@ -107,17 +107,10 @@
#
# @param [Object] value the target value
# @param [ActiveRecord::ConnectionAdapters::PostgreSQLColumn] column the target column
# @return [String] the quoted string
def column_aware_quote(value, column)
- if column.try(:sql_type) == 'bytea'
- quoted_value = "'#{escape_bytea value}'"
- # tests showed that there is a wrong leading double backslash under JRuby
- quoted_value.sub!(/\\\\/, '\\')
- quoted_value
- else
- quote value
- end
+ quote column.type_cast_for_database value
end
# Casts a value returned from the database back into the according ruby type.
#
# @param [Object] value the received value