aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/migration/command_recorder.rb
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2012-11-19 00:57:10 -0500
committerMarc-Andre Lafortune <github@marc-andre.ca>2012-12-21 13:54:51 -0500
commitbd155d2ae31a1e4c19274cfef6049d66136fd0cd (patch)
tree732f4c28675d585ed0f9e61f497df9b658ed80e1 /activerecord/lib/active_record/migration/command_recorder.rb
parent99770e4c659013461fb308040e3d594f2038ed24 (diff)
downloadrails-bd155d2ae31a1e4c19274cfef6049d66136fd0cd.tar.gz
rails-bd155d2ae31a1e4c19274cfef6049d66136fd0cd.tar.bz2
rails-bd155d2ae31a1e4c19274cfef6049d66136fd0cd.zip
Add drop_join_table [#8267]
Diffstat (limited to 'activerecord/lib/active_record/migration/command_recorder.rb')
-rw-r--r--activerecord/lib/active_record/migration/command_recorder.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb
index d0e54240d3..8dad1b123f 100644
--- a/activerecord/lib/active_record/migration/command_recorder.rb
+++ b/activerecord/lib/active_record/migration/command_recorder.rb
@@ -73,6 +73,7 @@ module ActiveRecord
[:create_table, :create_join_table, :change_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,
].each do |method|
class_eval <<-EOV, __FILE__, __LINE__ + 1
def #{method}(*args, &block) # def create_table(*args, &block)
@@ -93,10 +94,12 @@ module ActiveRecord
[:drop_table, [args.first]]
end
- def invert_create_join_table(args)
- table_name = find_join_table_name(*args)
+ def invert_create_join_table(args, &block)
+ [:drop_join_table, args, block]
+ end
- [:drop_table, [table_name]]
+ def invert_drop_join_table(args, &block)
+ [:create_join_table, args, block]
end
def invert_rename_table(args)