You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If creating or updating data as part of a migration (e.g. creating a few records for a lookup table), it's considered good practice to inline the model definition to not break the migration if future changes are made, such as removing or renaming the model.
Expected behavior
To not trigger any warning when defining a local ActiveRecord model when needing to create or update data as part of the migration.
The Rails/ReversibleMigrationMethodDefinition rule triggered a warning:
C: Rails/ReversibleMigrationMethodDefinition: Migrations must contain either a change method, or both an up and a down method.
class NotificationType < ApplicationRecord ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Steps to reproduce the problem
Edit any migration file and paste the example from the "Actual behavior" section
Run bundle exec rubocop --only Rails/ReversibleMigrationMethodDefinition
The warning should be reported on the line defining the inline ActiveRecord model
If creating or updating data as part of a migration (e.g. creating a few records for a lookup table), it's considered good practice to inline the model definition to not break the migration if future changes are made, such as removing or renaming the model.
Expected behavior
To not trigger any warning when defining a local ActiveRecord model when needing to create or update data as part of the migration.
Actual behavior
With this example migration:
The
Rails/ReversibleMigrationMethodDefinition
rule triggered a warning:Steps to reproduce the problem
bundle exec rubocop --only Rails/ReversibleMigrationMethodDefinition
RuboCop version
The text was updated successfully, but these errors were encountered: