Class: RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods
- Defined in:
- lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb
Overview
This cop checks direct manipulation of ActiveModel#errors as hash. These operations are deprecated in Rails 6.1 and will not work in Rails 7.
Constant Summary collapse
- MSG =
'Avoid manipulating ActiveModel errors as hash directly.'- MANIPULATIVE_METHODS =
Set[ *%i[ << append clear collect! compact! concat delete delete_at delete_if drop drop_while fill filter! keep_if flatten! insert map! pop prepend push reject! replace reverse! rotate! select! shift shuffle! slice! sort! sort_by! uniq! unshift ] ].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
90 91 92 93 94 |
# File 'lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb', line 90 def on_send(node) any_manipulation?(node) do add_offense(node) end end |