Blacklist the use of "becomes(SomeClass)" in Rubocop
In https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20313 I found out that becomes(SomeClass)
(e.g. becomes(Namespace)
) will result in eager loaded associations being ignored. This in turn can cause N+1 problems. We can easily work around this by just using the desired path methods (admin_foo_path
for example).
To prevent future performance problems (and fix existing ones), we should add a Cop that disallows the use of becomes(SomeClass)
.