From ba56cfaf1f8f3deedbf7d224142fd27234a330d3 Mon Sep 17 00:00:00 2001 From: d-m-u Date: Thu, 7 May 2020 21:42:58 -0400 Subject: [PATCH] nix the string interpolation thanks Keenan and Jason :) --- app/models/mixins/aggregation_mixin/methods.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/mixins/aggregation_mixin/methods.rb b/app/models/mixins/aggregation_mixin/methods.rb index 866f2025ffc8..f3ae6567730e 100644 --- a/app/models/mixins/aggregation_mixin/methods.rb +++ b/app/models/mixins/aggregation_mixin/methods.rb @@ -39,11 +39,11 @@ def all_storages end def aggregate_hardware(from, field, targets = nil) - from = from.to_s.singularize + from = from.to_s.singularize.to_sym select = field == :aggregate_cpu_speed ? "cpu_total_cores, cpu_speed" : field targets ||= send("all_#{from}_ids") targets = targets.collect(&:id) unless targets.first.kind_of?(Integer) - hdws = Hardware.where("#{from}_id".to_sym => targets).select(select) + hdws = Hardware.where(from => targets).select(select) hdws.inject(0) { |t, hdw| t + hdw.send(field).to_i } end