Class: RuboCop::Cop::Rails::ReversibleMigrationMethodDefinition
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::ReversibleMigrationMethodDefinition
- Includes:
- MigrationsHelper
- Defined in:
- lib/rubocop/cop/rails/reversible_migration_method_definition.rb
Overview
Checks whether the migration implements either a ‘change` method or both an `up` and a `down` method.
Constant Summary collapse
- MSG =
'Migrations must contain either a `change` method, or both an `up` and a `down` method.'
Instance Method Summary collapse
Methods included from MigrationsHelper
Instance Method Details
#on_class(node) ⇒ Object
58 59 60 61 62 |
# File 'lib/rubocop/cop/rails/reversible_migration_method_definition.rb', line 58 def on_class(node) return if !migration_class?(node) || change_method?(node) || up_and_down_methods?(node) add_offense(node) end |