Issue 13466: Named scopes evaluated with instance_eval. ScopeRegistry us...

...es class instead of base_class