aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/migration
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-01-30 05:45:41 +1030
committerMatthew Draper <matthew@trebex.net>2016-01-30 05:45:41 +1030
commitda6342779b3228e1796ed4e3c385b52d60821b0f (patch)
tree95240e7c65668d909019a97e2621c3863a61e5ff /activerecord/lib/active_record/migration
parent7d288244b25604d47edc2adaeb7040301cf6c95d (diff)
downloadrails-da6342779b3228e1796ed4e3c385b52d60821b0f.tar.gz
rails-da6342779b3228e1796ed4e3c385b52d60821b0f.tar.bz2
rails-da6342779b3228e1796ed4e3c385b52d60821b0f.zip
Intervene on change_table as well as create_table
Diffstat (limited to 'activerecord/lib/active_record/migration')
-rw-r--r--activerecord/lib/active_record/migration/compatibility.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/migration/compatibility.rb b/activerecord/lib/active_record/migration/compatibility.rb
index 5d742b523b..45e35a4f71 100644
--- a/activerecord/lib/active_record/migration/compatibility.rb
+++ b/activerecord/lib/active_record/migration/compatibility.rb
@@ -30,6 +30,19 @@ module ActiveRecord
end
end
+ def change_table(table_name, options = {})
+ if block_given?
+ super(table_name, options) do |t|
+ class << t
+ prepend TableDefinition
+ end
+ yield t
+ end
+ else
+ super
+ end
+ end
+
def add_reference(*, **options)
options[:index] ||= false
super