Skip to content

Commit

Permalink
Support refactored remove_column
Browse files Browse the repository at this point in the history
  • Loading branch information
yahonda committed Jun 4, 2012
1 parent d79a7fb commit 166bcb2
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -257,8 +257,9 @@ def rename_column(table_name, column_name, new_column_name) #:nodoc:
clear_table_columns_cache(table_name)
end

def remove_column(table_name, column_name) #:nodoc:
execute "ALTER TABLE #{quote_table_name(table_name)} DROP COLUMN #{quote_column_name(column_name)}"
def remove_column(table_name, *column_names) #:nodoc:
raise ArgumentError.new("You must specify at least one column name. Example: remove_column(:people, :first_name)") if column_names.empty?
column_names.each {|column_name| execute "ALTER TABLE #{quote_table_name(table_name)} DROP COLUMN #{quote_column_name(column_name)}"}
ensure
clear_table_columns_cache(table_name)
end
Expand Down

0 comments on commit 166bcb2

Please sign in to comment.