Class: RuboCop::Cop::Migration::RemoveColumn
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Migration::RemoveColumn
- Defined in:
- lib/rubocop/cop/migration/remove_column.rb
Overview
Make sure the column is already ignored by the running app before removing it.
Active Record caches database columns at runtime, so if you drop a column, it can cause exceptions until your app reboots.
Note that since this cop goes to read arbitrary model files, false negatives occur in situations where RuboCop’s cache is being used.
Defined Under Namespace
Classes: Parser
Constant Summary collapse
- MSG =
'Make sure the column is already ignored by the running app before removing it.'- RESTRICT_ON_SEND =
%i[ remove_column ].freeze
Instance Method Summary collapse
- #on_send(node) ⇒ void (also: #on_csend)
Instance Method Details
#on_send(node) ⇒ void Also known as: on_csend
This method returns an undefined value.
49 50 51 52 53 |
# File 'lib/rubocop/cop/migration/remove_column.rb', line 49 def on_send(node) return unless bad?(node) add_offense(node) end |