Fix CI runner validation
What does this MR do and why?
In Rails 7, #one?
executes a COUNT query even though there are unpersisted records in the association. This may be a bug in Rails 7 but I haven't investigated further.
In this MR, I just change the validation to use #size
since they are similar. This also executes a COUNT query when the associated records are persisted and the relation is not loaded yet.
This is extracted from !90907 (merged) to make the MR smaller
Example Rails 7 failure can be seen in https://gitlab.com/gitlab-org/gitlab/-/jobs/3946108357
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Heinrich Lee Yu