Class: RuboCop::Cop::Rails::ReversibleMigrationMethodDefinition
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::ReversibleMigrationMethodDefinition
- Defined in:
- lib/rubocop/cop/rails/reversible_migration_method_definition.rb
Overview
This cop 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
Instance Method Details
#on_class(node) ⇒ Object
67 68 69 70 71 |
# File 'lib/rubocop/cop/rails/reversible_migration_method_definition.rb', line 67 def on_class(node) return if change_method?(node) || up_and_down_methods?(node) add_offense(node) end |