commit 619e156986dde1b674fa1e56bad4bc862c6e9df3 Author: Victor Campos Date: Tue Jul 12 19:37:14 2016 -0300 improve update/create speed diff --git a/app/models/project.rb b/app/models/project.rb index 660a486..88bd8eb 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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.includes(: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