From 28afb01fe389db0505dd8f3e6a061e645273883d Mon Sep 17 00:00:00 2001 From: kennyj Date: Wed, 4 Jan 2012 10:25:15 +0900 Subject: [PATCH] Fix GH #4285. Remove options when we record calling creat_table --- .../lib/active_record/migration/command_recorder.rb | 2 +- activerecord/test/cases/migration/command_recorder_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb index ffee5a081a9..4e27293cb44 100644 --- a/activerecord/lib/active_record/migration/command_recorder.rb +++ b/activerecord/lib/active_record/migration/command_recorder.rb @@ -59,7 +59,7 @@ def #{method}(*args) # def create_table(*args) private def invert_create_table(args) - [:drop_table, args] + [:drop_table, [args.first]] end def invert_rename_table(args) diff --git a/activerecord/test/cases/migration/command_recorder_test.rb b/activerecord/test/cases/migration/command_recorder_test.rb index d108b456f0f..8f136bce2b3 100644 --- a/activerecord/test/cases/migration/command_recorder_test.rb +++ b/activerecord/test/cases/migration/command_recorder_test.rb @@ -67,6 +67,12 @@ def test_invert_create_table assert_equal [:drop_table, [:system_settings]], drop_table end + def test_invert_create_table_with_options + @recorder.record :create_table, [:people_reminders, {:id => false}] + drop_table = @recorder.inverse.first + assert_equal [:drop_table, [:people_reminders]], drop_table + end + def test_invert_rename_table @recorder.record :rename_table, [:old, :new] rename = @recorder.inverse.first