Sha256: e552a5dca0815338039a33fbe2e7b222abbdecea77c5761d8121cb69f2ff10f7
Contents?: true
Size: 1.08 KB
Versions: 13
Compression:
Stored size: 1.08 KB
Contents
module Torque module PostgreSQL module Adapter module Quoting Name = ActiveRecord::ConnectionAdapters::PostgreSQL::Name # Quotes type names for use in SQL queries. def quote_type_name(string, schema = nil) name_schema, table = string.to_s.scan(/[^".\s]+|"[^"]*"/) if table.nil? table = name_schema name_schema = nil end schema = schema || name_schema || 'public' Name.new(schema, table).quoted end def quote_default_expression(value, column) if value.class <= Array quote(value) + '::' + column.sql_type else super end end private def _quote(value) return super unless value.is_a?(Array) values = value.map(&method(:quote)) "ARRAY[#{values.join(','.freeze)}]" end def _type_cast(value) return super unless value.is_a?(Array) value.map(&method(:quote)).join(','.freeze) end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems