Fix "rails g migration" not always using migration templates
Normally, this is what's supposed to happen when you invoke `rails g generate migration`: 1. `Rails.application.load_generators` is called here: https://github.com/rails/rails/blob/v4.2.10/railties/lib/rails/commands/commands_tasks.rb#L129 2. This loads the local `generator_templates` path in https://github.com/rails/rails/blob/v4.2.10/railties/lib/rails/generators.rb#L69. However, when metrics are enabled, the application is eager loaded here in the initializer. This short-circuits the `load_generators` and loads `ActiveRecord::Generators::MigrationGenerator` automatically, so the custom path is never loaded properly. With this change, we skip the initializing of metrics and eager loading if generators are in use. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/52651
Showing
Please register or sign in to comment