aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-12-21 19:55:23 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-12-21 19:55:24 -0200
commit4da76d7d4a67726a5cc484c13e43d4c5b170b916 (patch)
treea0c9d7b54312e0ac1ee0c2ab3c83d6564e536505
parent29762822517abe1c3218b23525250826f3c80da6 (diff)
downloadrails-4da76d7d4a67726a5cc484c13e43d4c5b170b916.tar.gz
rails-4da76d7d4a67726a5cc484c13e43d4c5b170b916.tar.bz2
rails-4da76d7d4a67726a5cc484c13e43d4c5b170b916.zip
Remove duplicated methods in command recorder and duplicated test name
-rw-r--r--activerecord/lib/active_record/migration/command_recorder.rb6
-rw-r--r--activerecord/test/cases/migration/create_join_table_test.rb2
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb
index 13ce28330a..a6377185a8 100644
--- a/activerecord/lib/active_record/migration/command_recorder.rb
+++ b/activerecord/lib/active_record/migration/command_recorder.rb
@@ -72,8 +72,8 @@ module ActiveRecord
[:create_table, :create_join_table, :rename_table, :add_column, :remove_column,
:rename_index, :rename_column, :add_index, :remove_index, :add_timestamps, :remove_timestamps,
- :change_column, :change_column_default, :add_reference, :remove_reference, :transaction,
- :drop_join_table, :drop_table, :remove_index,
+ :change_column_default, :add_reference, :remove_reference, :transaction,
+ :drop_join_table, :drop_table,
:change_column, :execute, :remove_columns, # irreversible methods need to be here too
].each do |method|
class_eval <<-EOV, __FILE__, __LINE__ + 1
@@ -100,7 +100,7 @@ module ActiveRecord
add_timestamps: :remove_timestamps,
add_reference: :remove_reference,
}.each do |cmd, inv|
- [[inv, cmd], [cmd, inv]].each do |method, inverse|
+ [[inv, cmd], [cmd, inv]].uniq.each do |method, inverse|
class_eval <<-EOV, __FILE__, __LINE__ + 1
def invert_#{method}(args, &block) # def invert_create_table(args, &block)
[:#{inverse}, args, block] # [:drop_table, args, block]
diff --git a/activerecord/test/cases/migration/create_join_table_test.rb b/activerecord/test/cases/migration/create_join_table_test.rb
index c099854ad8..efaec0f823 100644
--- a/activerecord/test/cases/migration/create_join_table_test.rb
+++ b/activerecord/test/cases/migration/create_join_table_test.rb
@@ -114,7 +114,7 @@ module ActiveRecord
assert !connection.tables.include?('catalog')
end
- def test_create_join_table_with_column_options
+ def test_drop_join_table_with_column_options
connection.create_join_table :artists, :musics, column_options: {null: true}
connection.drop_join_table :artists, :musics, column_options: {null: true}