Class: RuboCop::Cop::Captive::StringWhereInScope

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

Constant Summary collapse

MSG =
'The `where` method should be used in a scope in a model.'

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/rubocop/cop/captive/string_where_in_scope.rb', line 13

def on_send(node)
  return unless where_with_string?(node)

  options_node = node.arguments[0]
  return if options_node&.hash_type?

  add_offense(options_node, message: MSG)
end