diff options
author | Matthew Draper <matthew@trebex.net> | 2016-01-30 05:45:41 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2016-01-30 05:45:41 +1030 |
commit | da6342779b3228e1796ed4e3c385b52d60821b0f (patch) | |
tree | 95240e7c65668d909019a97e2621c3863a61e5ff | |
parent | 7d288244b25604d47edc2adaeb7040301cf6c95d (diff) | |
download | rails-da6342779b3228e1796ed4e3c385b52d60821b0f.tar.gz rails-da6342779b3228e1796ed4e3c385b52d60821b0f.tar.bz2 rails-da6342779b3228e1796ed4e3c385b52d60821b0f.zip |
Intervene on change_table as well as create_table
-rw-r--r-- | activerecord/lib/active_record/migration/compatibility.rb | 13 |
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 |