Fix named scope + class method example

Closes #8804 [ci skip]