class RuboCop::Cop::Rails::ActiveRecordAliases
Book.update!(author: ‘Alice’)
#good
Book.update_attributes!(author: ‘Alice’)
#bad
@example
are more clear and easier to read.
Checks that ActiveRecord aliases are not used. The direct method names
def on_send(node)
def on_send(node) method_name = node.method_name alias_method = ALIASES[method_name] add_offense( node.loc.selector, message: format(MSG, prefer: alias_method, current: method_name), severity: :warning ) do |corrector| corrector.replace(node.loc.selector, alias_method) end end