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

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

#quote_default_expression(value, column) ⇒ Object

:nodoc:



156
157
158
159
160
161
162
163
164
165
166
167
# File 'activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb', line 156

def quote_default_expression(value, column) # :nodoc:
  if value.is_a?(Proc)
    value.call
  elsif column.type == :uuid && value.is_a?(String) && value.include?("()")
    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