Skip to content
Browse files

Use existing #empty_insert_statement_value for an insert with no colu…

…mns.
  • Loading branch information...
1 parent bf40c72 commit 35d0b6029fe499254d74a3cd5dc4c0397d3a50ee @metaskills metaskills committed
View
4 activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
@@ -287,10 +287,6 @@ def insert_fixture(fixture, table_name)
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
View
4 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
@@ -346,10 +346,6 @@ def rename_column(table_name, column_name, new_column_name) #:nodoc:
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
View
2 activerecord/lib/active_record/relation.rb
@@ -60,7 +60,7 @@ def insert(values)
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

0 comments on commit 35d0b60

Please sign in to comment.
Something went wrong with that request. Please try again.