Class: RuboCop::Cop::Migration::AcknowledgeIgnoredColumn
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Migration::AcknowledgeIgnoredColumn
- Defined in:
- lib/rubocop/cop/migration/acknowledge_ignored_column.rb
Overview
class RemoveUsersSomeColumn < ActiveRecord::Migration def change remove_column :users, :some_column # rubocop:disable Migration/AcknowledgeIgnoredColumn end end
Constant Summary collapse
- MSG =
"Do not remove a column until it is already ignored in production and " \ "all references to it are removed. Once done, remove the 'ignored_columns' " \ "from the Model and disable this cop to acknowledge this is safe."
Instance Method Summary collapse
- #on_block(node) ⇒ Object
- #on_send(node) ⇒ Object (also: #on_csend)
Instance Method Details
#on_block(node) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rubocop/cop/migration/acknowledge_ignored_column.rb', line 40 def on_block(node) return unless change_table_block?(node) block_arg = node.arguments.first return unless block_arg remove_calls(node, block_arg.name) do |rename_node| add_offense(rename_node) end end |
#on_send(node) ⇒ Object Also known as: on_csend
33 34 35 36 37 |
# File 'lib/rubocop/cop/migration/acknowledge_ignored_column.rb', line 33 def on_send(node) return unless remove_column?(node) add_offense(node) end |