Class: RuboCop::Cop::Netlify::InvalidModelAssignment

Inherits:
RuboCop::Cop
  • Object
show all
Defined in:
lib/rubocop/cop/netlify/invalid_model_assignment.rb

Overview

This cop checks attribute assignment of Mongoid models

Examples:

# bad
form.attributes[:email] = "[email protected]"

# good
form.email = "[email protected]"

Constant Summary collapse

MSG =
"Assigning to `attributes` will not update record"

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



21
22
23
# File 'lib/rubocop/cop/netlify/invalid_model_assignment.rb', line 21

def on_send(node)
  add_offense(node) if assign_attributes? node
end