diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-11-20 17:31:22 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-11-20 17:31:22 +0100 |
commit | 1064a9d827b5ec773e13c9bd10459f598b6ef84f (patch) | |
tree | 7339f7e91362f2f8d7030b5765109c61aa9e6830 | |
parent | 33c2a7e23c3e53f05ac93ec533e2c9b238e2cc34 (diff) |
Override Migrator.new instead of Migrator#initialize, it's easier to understand
-rw-r--r-- | config/initializers/0_duplicate_migrations.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/config/initializers/0_duplicate_migrations.rb b/config/initializers/0_duplicate_migrations.rb index d15d2b24a..509a069e6 100644 --- a/config/initializers/0_duplicate_migrations.rb +++ b/config/initializers/0_duplicate_migrations.rb @@ -16,9 +16,7 @@ ALLOWED_DUPLICATES = [20180410220657, 20180831171112].freeze module ActiveRecord class Migrator - old_initialize = instance_method(:initialize) - - define_method(:initialize) do |direction, migrations, target_version| + def self.new(direction, migrations, target_version = nil) migrated = Set.new(Base.connection.migration_context.get_all_versions) migrations.group_by(&:name).each do |name, duplicates| @@ -36,7 +34,7 @@ module ActiveRecord end end - old_initialize.bind(self).(direction, migrations, target_version) + super(direction, migrations, target_version) end end end |