Skip to content

Commit

Permalink
fix the sql injection brakeman warning
Browse files Browse the repository at this point in the history
  • Loading branch information
d-m-u committed May 6, 2020
1 parent 927b99f commit d813ed2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/mixins/aggregation_mixin/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def aggregate_hardware(from, field, targets = nil)
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" => targets).select(select)
hdws = Hardware.where("#{from}_id".to_sym => targets).select(select)

hdws.inject(0) { |t, hdw| t + hdw.send(field).to_i }
end
Expand Down

0 comments on commit d813ed2

Please sign in to comment.