DEV: Instantiate relation early to save a query (#14766)

DEV: Instantiate relation early to save a query (#14766)

Previously it would do SELECT 1 AS one and then SELECT "color_scheme_colors".*. Now it only does the latter.

diff --git a/app/models/color_scheme.rb b/app/models/color_scheme.rb
index bcd7d7c..afb897f 100644
--- a/app/models/color_scheme.rb
+++ b/app/models/color_scheme.rb
@@ -346,7 +346,7 @@ class ColorScheme < ActiveRecord::Base
   end
 
   def is_dark?
-    return if colors.empty?
+    return if colors.to_a.empty?
 
     primary_b = brightness(colors_by_name["primary"].hex)
     secondary_b = brightness(colors_by_name["secondary"].hex)

GitHub sha: 19c9b892dcd2f7d7c811a9925127776d4b4fb0f3

This commit appears in #14766 which was approved by martin. It was merged by CvX.