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.
This commit is contained in:
Jarek Radosz 2021-10-29 03:03:22 +02:00 committed by GitHub
parent b1603c8667
commit 19c9b892dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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)