Method: ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting#quote_default_expression

Defined in:
lib/active_record/connection_adapters/postgresql/quoting.rb

#quote_default_expression(value, column) ⇒ Object

:nodoc:



118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/active_record/connection_adapters/postgresql/quoting.rb', line 118

def quote_default_expression(value, column) # :nodoc:
  if value.is_a?(Proc)
    value.call
  elsif column.type == :uuid && value.is_a?(String) && /\(\)/.match?(value)
    value # Does not quote function default values for UUID columns
  elsif column.respond_to?(:array?)
    type = lookup_cast_type_from_column(column)
    quote(type.serialize(value))
  else
    super
  end
end