PERF: Remove N+1 query in `SiteSerializer#user_color_schemes`.
This commit is contained in:
parent
2e4182b4b3
commit
eea9fead63
|
@ -50,7 +50,7 @@ class SiteSerializer < ApplicationSerializer
|
|||
|
||||
def user_color_schemes
|
||||
cache_fragment("user_color_schemes") do
|
||||
schemes = ColorScheme.where('user_selectable').order(:name)
|
||||
schemes = ColorScheme.includes(:color_scheme_colors).where('user_selectable').order(:name)
|
||||
ActiveModel::ArraySerializer.new(schemes, each_serializer: ColorSchemeSelectableSerializer).as_json
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue