mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 13:53:45 +08:00
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:
parent
b1603c8667
commit
19c9b892dc
|
@ -346,7 +346,7 @@ class ColorScheme < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_dark?
|
def is_dark?
|
||||||
return if colors.empty?
|
return if colors.to_a.empty?
|
||||||
|
|
||||||
primary_b = brightness(colors_by_name["primary"].hex)
|
primary_b = brightness(colors_by_name["primary"].hex)
|
||||||
secondary_b = brightness(colors_by_name["secondary"].hex)
|
secondary_b = brightness(colors_by_name["secondary"].hex)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user