diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c4b0324f..a19c81bcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ### Bugs Fixed + * [#722](https://github.com/toptal/chewy/pull/722): Remove alias_method_chain, use Module#prepend instead ([@dalthon][]) + ## 7.0.0 (2021-02-22) ### New Features diff --git a/lib/chewy/railtie.rb b/lib/chewy/railtie.rb index eee33adee..5d1c48104 100644 --- a/lib/chewy/railtie.rb +++ b/lib/chewy/railtie.rb @@ -22,17 +22,6 @@ def call(env) end module MigrationStrategy - extend ActiveSupport::Concern - included do - alias_method_chain :migrate, :chewy - end - - def migrate_with_chewy(*args) - Chewy.strategy(:bypass) { migrate_without_chewy(*args) } - end - end - - module Rails5MigrationStrategy def migrate(*args) Chewy.strategy(:bypass) { super } end @@ -57,13 +46,8 @@ def migrate(*args) initializer 'chewy.migration_strategy' do ActiveSupport.on_load(:active_record) do - if Rails::VERSION::MAJOR >= 5 - ActiveRecord::Migration.prepend(Rails5MigrationStrategy) - ActiveRecord::Migrator.prepend(Rails5MigrationStrategy) if defined? ActiveRecord::Migrator - else - ActiveRecord::Migration.send(:include, MigrationStrategy) - ActiveRecord::Migrator.send(:include, MigrationStrategy) if defined? ActiveRecord::Migrator - end + ActiveRecord::Migration.prepend(MigrationStrategy) + ActiveRecord::Migrator.prepend(MigrationStrategy) if defined? ActiveRecord::Migrator end end