Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove duplicated methods in command recorder and duplicated test name

  • Loading branch information...
commit 4da76d7d4a67726a5cc484c13e43d4c5b170b916 1 parent 2976282
@carlosantoniodasilva carlosantoniodasilva authored
View
6 activerecord/lib/active_record/migration/command_recorder.rb
@@ -72,8 +72,8 @@ def respond_to?(*args) # :nodoc:
[: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 StraightReversions
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]
View
2  activerecord/test/cases/migration/create_join_table_test.rb
@@ -114,7 +114,7 @@ def test_drop_join_table_with_the_table_name_as_string
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}
Please sign in to comment.
Something went wrong with that request. Please try again.