mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Refactor add_column_options!
, to move the quoting of default value for :uuid in quote_value
.
This commit is contained in:
parent
200b9035da
commit
91fca372b1
1 changed files with 12 additions and 4 deletions
|
@ -19,14 +19,22 @@ module ActiveRecord
|
|||
sql
|
||||
end
|
||||
|
||||
def column_options(o)
|
||||
column_options = super
|
||||
column_options[:array] = o.array
|
||||
column_options
|
||||
end
|
||||
|
||||
def add_column_options!(sql, options)
|
||||
if options[:array] || options[:column].try(:array)
|
||||
if options[:array]
|
||||
sql << '[]'
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
column = options.fetch(:column) { return super }
|
||||
if column.type == :uuid && options[:default] =~ /\(\)/
|
||||
sql << " DEFAULT #{options[:default]}"
|
||||
def quote_value(value, column)
|
||||
if column.type == :uuid && value =~ /\(\)/
|
||||
value
|
||||
else
|
||||
super
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue