]> source.dussan.org Git - redmine.git/commitdiff
Optimize the N+1 query in watcher_recipients. #5415
authorEric Davis <edavis@littlestreamsoftware.com>
Sun, 20 Jun 2010 18:41:30 +0000 (18:41 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Sun, 20 Jun 2010 18:41:30 +0000 (18:41 +0000)
Contributed by Holger Just

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3803 e93f8b46-1217-0410-a6f0-8f06a7374b81

vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb

index b4ac776ece6951dc07d68c3722174aa2498aa916..e026a6dd40f36f32a0ac74dc01dfc14d52946675 100644 (file)
@@ -57,7 +57,8 @@ module Redmine
         
         # Returns an array of watchers' email addresses
         def watcher_recipients
-          notified = watchers.collect(&:user).select(&:active?)
+          notified = watcher_users.active
+
           if respond_to?(:visible?)
             notified.reject! {|user| !visible?(user)}
           end