Skip to content

Commit

Permalink
Use existing #empty_insert_statement_value for an insert with no colu…
Browse files Browse the repository at this point in the history
…mns.
  • Loading branch information
metaskills committed Apr 24, 2011
1 parent bf40c72 commit 35d0b60
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/relation.rb
Expand Up @@ -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
Expand Down

0 comments on commit 35d0b60

Please sign in to comment.