Class: RuboCop::Cop::Sequel::SaveChanges
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Sequel::SaveChanges
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/sequel/save_changes.rb
Overview
SaveChanges promotes the use of save_changes.
Constant Summary collapse
- MSG =
'Use `Sequel::Model#save_changes` instead of `Sequel::Model#save`.'
- RESTRICT_ON_SEND =
%i[save].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/rubocop/cop/sequel/save_changes.rb', line 17 def on_send(node) return unless model_save?(node) range = node.loc.selector add_offense(range, message: MSG) do |corrector| corrector.replace(range, 'save_changes') end end |