summaryrefslogtreecommitdiffstats
path: root/app/models/watcher.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-02 20:23:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-02 20:23:48 +0000
commit536747b74708188848d85d8de5df34e7aa762006 (patch)
treec7cfe03314c047dff313825c8548d056e5e1af29 /app/models/watcher.rb
parent96fca0b08f6d60e8736e8e3f95a5d0ae33779068 (diff)
downloadredmine-536747b74708188848d85d8de5df34e7aa762006.tar.gz
redmine-536747b74708188848d85d8de5df34e7aa762006.zip
Replaces find(:all) calls.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10917 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/watcher.rb')
-rw-r--r--app/models/watcher.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/watcher.rb b/app/models/watcher.rb
index d9ce65fb6..2f5841bb5 100644
--- a/app/models/watcher.rb
+++ b/app/models/watcher.rb
@@ -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)