Fix detection of null relations for Rails 7
What does this MR do and why?
In Rails 7, ActiveRecord::NullRelation.to_sql no longer results into a blank string. So we check for the class of the relation instead.
Rails 6:
[1] pry(main)> Issue.none.to_sql
=> ""
Rails 7:
[1] pry(main)> Issue.none.to_sql
=> "SELECT \"issues\".* FROM \"issues\" WHERE (1=0)"
Related failure: https://gitlab.com/gitlab-org/gitlab/-/jobs/3669887028
Refs &7875 (closed)
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 Peter Leitzen