From: Toshi MARUYAMA Date: Fri, 14 Feb 2014 02:33:00 +0000 (+0000) Subject: Rails4: replace deprecated Relation#sum with finder options at lib/redmine/helpers... X-Git-Tag: 2.5.0~27 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0aaf7f799aba40ef7edb3252fc5fbc398d54daf7;p=redmine.git Rails4: replace deprecated Relation#sum with finder options at lib/redmine/helpers/time_report.rb git-svn-id: http://svn.redmine.org/redmine/trunk@12881 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/lib/redmine/helpers/time_report.rb b/lib/redmine/helpers/time_report.rb index 2c71f098b..14a09694e 100644 --- a/lib/redmine/helpers/time_report.rb +++ b/lib/redmine/helpers/time_report.rb @@ -45,10 +45,10 @@ module Redmine unless @criteria.empty? time_columns = %w(tyear tmonth tweek spent_on) @hours = [] - @scope.sum(:hours, - :include => [:issue, :activity], - :group => @criteria.collect{|criteria| @available_criteria[criteria][:sql]} + time_columns, - :joins => @criteria.collect{|criteria| @available_criteria[criteria][:joins]}.compact).each do |hash, hours| + @scope.includes(:issue, :activity). + group(@criteria.collect{|criteria| @available_criteria[criteria][:sql]} + time_columns). + joins(@criteria.collect{|criteria| @available_criteria[criteria][:joins]}.compact). + sum(:hours).each do |hash, hours| h = {'hours' => hours} (@criteria + time_columns).each_with_index do |name, i| h[name] = hash[i]