class RuboCop::Cop::Rails::DefaultScope
default_scope { something }
# correct
default_scope -> { something }
# incorrect
@example
a lambda or a proc instead of a block.
This cop checks for default_scope calls when it was passed
def on_send(node)
def on_send(node) return unless command?(:default_scope, node) _receiver, _method_name, *args = *node return unless args.size == 1 first_arg = args[0] return unless first_arg.type != :block || lambda_or_proc?(first_arg) add_offense(first_arg, :expression) end