Follow-up from "Use find_by instead of where + first"
The following discussion from !27618 (merged) should be addressed:
-
@tancnle started a discussion: (+1 comment) There seems to be quite a few of these instances too.
$ rg "where\(.*\)\.first" --type ruby --count app/finders/keys_finder.rb:1 app/models/user_interacted_project.rb:1 app/models/user.rb:1 spec/migrations/delete_template_services_duplicated_by_type_spec.rb:2 spec/migrations/schedule_to_archive_legacy_traces_spec.rb:3 spec/migrations/migrate_auto_dev_ops_domain_to_cluster_domain_spec.rb:2 spec/migrations/nullify_users_role_spec.rb:3 ee/app/models/approval_merge_request_rule.rb:1 ee/app/models/merge_train.rb:1 ee/app/controllers/unsubscribes_controller.rb:1 app/controllers/admin/services_controller.rb:2 app/services/projects/detect_repository_languages_service.rb:1 app/models/concerns/mentionable.rb:1 spec/requests/api/jobs_spec.rb:3 spec/controllers/admin/services_controller_spec.rb:1 spec/services/ci/retry_pipeline_service_spec.rb:1 spec/services/emails/create_service_spec.rb:1 spec/services/projects/fork_service_spec.rb:2 spec/services/issues/move_service_spec.rb:1 lib/gitlab/import_export/members_mapper.rb:1 ee/app/models/geo/event_log.rb:1 ee/db/fixtures/development/30_customizable_cycle_analytics.rb:2 ee/spec/requests/api/maven_packages_spec.rb:2 ee/spec/services/epics/issue_promote_service_spec.rb:1 spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb:1 spec/lib/gitlab/git/tree_spec.rb:3 spec/views/projects/tree/_tree_row.html.haml_spec.rb:1 lib/gitlab/import_export/base/object_builder.rb:1 spec/lib/gitlab/import_export/project/tree_restorer_spec.rb:3 lib/gitlab/database/rename_reserved_paths_migration/v1/rename_projects.rb:1 lib/gitlab/database/rename_reserved_paths_migration/v1/rename_namespaces.rb:1 ee/lib/ee/gitlab/auth/ldap/access.rb:1