remove unneeded Relation#all from Mailer model

git-svn-id: http://svn.redmine.org/redmine/trunk@12723 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2014-01-27 01:09:09 +00:00
parent ca3d706f56
commit ea8e5c74ec
1 changed files with 3 additions and 3 deletions

View File

@ -266,7 +266,7 @@ class Mailer < ActionMailer::Base
# Mailer.account_activation_request(user).deliver => sends an email to all active administrators # Mailer.account_activation_request(user).deliver => sends an email to all active administrators
def account_activation_request(user) def account_activation_request(user)
# Send the email to all active administrators # Send the email to all active administrators
recipients = User.active.where(:admin => true).all.collect { |u| u.mail }.compact recipients = User.active.where(:admin => true).collect { |u| u.mail }.compact
@user = user @user = user
@url = url_for(:controller => 'users', :action => 'index', @url = url_for(:controller => 'users', :action => 'index',
:status => User::STATUS_REGISTERED, :status => User::STATUS_REGISTERED,
@ -330,8 +330,8 @@ class Mailer < ActionMailer::Base
scope = scope.where(:assigned_to_id => user_ids) if user_ids.present? scope = scope.where(:assigned_to_id => user_ids) if user_ids.present?
scope = scope.where(:project_id => project.id) if project scope = scope.where(:project_id => project.id) if project
scope = scope.where(:tracker_id => tracker.id) if tracker scope = scope.where(:tracker_id => tracker.id) if tracker
issues_by_assignee = scope.includes(:status, :assigned_to, :project, :tracker).
issues_by_assignee = scope.includes(:status, :assigned_to, :project, :tracker).all.group_by(&:assigned_to) group_by(&:assigned_to)
issues_by_assignee.keys.each do |assignee| issues_by_assignee.keys.each do |assignee|
if assignee.is_a?(Group) if assignee.is_a?(Group)
assignee.users.each do |user| assignee.users.each do |user|