Migrate AR finder/query methods in UserMailer

Signed-off-by: Alex Coles <alex@alexbcoles.com>
pull/3194/head
Alex Coles 9 years ago
parent 72973cffb4
commit 7d3f723446
  1. 6
      app/mailers/user_mailer.rb

@ -443,9 +443,9 @@ class DueIssuesReminder
s << "#{WorkPackage.table_name}.project_id = #{@project.id}" if @project s << "#{WorkPackage.table_name}.project_id = #{@project.id}" if @project
s << "#{WorkPackage.table_name}.type_id = #{@type.id}" if @type s << "#{WorkPackage.table_name}.type_id = #{@type.id}" if @type
issues_by_assignee = WorkPackage.find(:all, include: [:status, :assigned_to, :project, :type], issues_by_assignee = WorkPackage.includes(:status, :assigned_to, :project, :type)
conditions: s.conditions .where(s.conditions)
).group_by(&:assigned_to) .group_by(&:assigned_to)
issues_by_assignee.each do |assignee, issues| issues_by_assignee.each do |assignee, issues|
UserMailer.reminder_mail(assignee, issues, @days).deliver if assignee && assignee.active? UserMailer.reminder_mail(assignee, issues, @days).deliver if assignee && assignee.active?
end end

Loading…
Cancel
Save