From 4486879fd216bc4f4d809275eb72db2a0ded06c7 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 5 Aug 2015 16:09:10 +1000 Subject: [PATCH] select less data --- app/models/concerns/has_custom_fields.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/concerns/has_custom_fields.rb b/app/models/concerns/has_custom_fields.rb index c9910bf0b48..1e1f3869a10 100644 --- a/app/models/concerns/has_custom_fields.rb +++ b/app/models/concerns/has_custom_fields.rb @@ -91,7 +91,9 @@ module HasCustomFields fk = (name.underscore << "_id") - "#{name}CustomField".constantize.where("#{fk} in (?)", map.keys) + "#{name}CustomField".constantize + .where("#{fk} in (?)", map.keys) + .where("name in (?)", fields) .pluck(fk, :name, :value).each do |id, name, value| preloaded = map[id].preloaded_custom_fields