]> source.dussan.org Git - redmine.git/commitdiff
Preload principals.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 12 Jun 2016 12:21:57 +0000 (12:21 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 12 Jun 2016 12:21:57 +0000 (12:21 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@15518 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/project.rb

index dee2e6dfd475bfba5a63c68add577cd9adbfb84d..e9b2647d4b9a934d83e5f4cc8cdcc6509dc47cad 100644 (file)
@@ -524,7 +524,7 @@ class Project < ActiveRecord::Base
   # Returns the users that should be notified on project events
   def notified_users
     # TODO: User part should be extracted to User#notify_about?
-    members.select {|m| m.principal.present? && (m.mail_notification? || m.principal.mail_notification == 'all')}.collect {|m| m.principal}
+    members.preload(:principal).select {|m| m.principal.present? && (m.mail_notification? || m.principal.mail_notification == 'all')}.collect {|m| m.principal}
   end
 
   # Returns a scope of all custom fields enabled for project issues