From da6342779b3228e1796ed4e3c385b52d60821b0f Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sat, 30 Jan 2016 05:45:41 +1030 Subject: Intervene on change_table as well as create_table --- activerecord/lib/active_record/migration/compatibility.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'activerecord/lib') 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 -- cgit v1.2.3