Replaces find(:all) calls.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10917 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-12-02 20:23:48 +00:00
parent 96fca0b08f
commit 536747b747
29 changed files with 70 additions and 71 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ class Watcher < ActiveRecord::Base
prune_single_user(options[:user], options)
else
pruned = 0
User.find(:all, :conditions => "id IN (SELECT DISTINCT user_id FROM #{table_name})").each do |user|
User.where("id IN (SELECT DISTINCT user_id FROM #{table_name})").all.each do |user|
pruned += prune_single_user(user, options)
end
pruned
@@ -47,7 +47,7 @@ class Watcher < ActiveRecord::Base
def self.prune_single_user(user, options={})
return unless user.is_a?(User)
pruned = 0
find(:all, :conditions => {:user_id => user.id}).each do |watcher|
where(:user_id => user.id).all.each do |watcher|
next if watcher.watchable.nil?
if options.has_key?(:project)