mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merged pull request #302 from metaskills/empty_inserts.
Use existing #empty_insert_statement_value for an insert with no columns.
This commit is contained in:
commit
2fc8d7ea90
3 changed files with 1 additions and 9 deletions
|
@ -287,10 +287,6 @@ module ActiveRecord
|
|||
execute "INSERT INTO #{quote_table_name(table_name)} (#{key_list.join(', ')}) VALUES (#{value_list.join(', ')})", 'Fixture Insert'
|
||||
end
|
||||
|
||||
def null_insert_value
|
||||
Arel.sql 'DEFAULT'
|
||||
end
|
||||
|
||||
def empty_insert_statement_value
|
||||
"VALUES(DEFAULT)"
|
||||
end
|
||||
|
|
|
@ -346,10 +346,6 @@ module ActiveRecord
|
|||
alter_table(table_name, :rename => {column_name.to_s => new_column_name.to_s})
|
||||
end
|
||||
|
||||
def null_insert_value
|
||||
Arel.sql 'NULL'
|
||||
end
|
||||
|
||||
def empty_insert_statement_value
|
||||
"VALUES(NULL)"
|
||||
end
|
||||
|
|
|
@ -60,7 +60,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
if values.empty? # empty insert
|
||||
im.values = im.create_values [connection.null_insert_value], []
|
||||
im.values = Arel.sql(connection.empty_insert_statement_value)
|
||||
else
|
||||
im.insert substitutes
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue