]> source.dussan.org Git - redmine.git/commitdiff
Code cleanup.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 9 Sep 2012 11:34:35 +0000 (11:34 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 9 Sep 2012 11:34:35 +0000 (11:34 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10337 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/mailer.rb

index b8b2ac721e510332d42e1567e5807a38157609d7..65ca9ea0850b15121cb95f6d348bf6b5c527d12b 100644 (file)
@@ -334,15 +334,15 @@ class Mailer < ActionMailer::Base
     tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil
     user_ids = options[:users]
 
-    scope = Issue.open.scoped(:conditions => ["#{Issue.table_name}.assigned_to_id IS NOT NULL" +
+    scope = Issue.open.where("#{Issue.table_name}.assigned_to_id IS NOT NULL" +
       " AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" +
-      " AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date]
+      " AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date
     )
-    scope = scope.scoped(:conditions => {:assigned_to_id => user_ids}) if user_ids.present?
-    scope = scope.scoped(:conditions => {:project_id => project.id}) if project
-    scope = scope.scoped(:conditions => {:tracker_id => tracker.id}) if tracker
+    scope = scope.where(:assigned_to_id => user_ids) if user_ids.present?
+    scope = scope.where(:project_id => project.id) if project
+    scope = scope.where(:tracker_id => tracker.id) if tracker
 
-    issues_by_assignee = scope.all(:include => [:status, :assigned_to, :project, :tracker]).group_by(&:assigned_to)
+    issues_by_assignee = scope.includes(:status, :assigned_to, :project, :tracker).all.group_by(&:assigned_to)
     issues_by_assignee.keys.each do |assignee|
       if assignee.is_a?(Group)
         assignee.users.each do |user|