summaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-03-10 05:10:43 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-03-10 05:10:43 +0000
commit22c1e2b8cf8527c1e97de976f3dd46e7bee7cba3 (patch)
treec868aacb521e2918f8ef1d67adf0b4c47b5b4ac2 /vendor
parentcfa1f0c231309c596900a0e82e89f15a4ab071a1 (diff)
downloadredmine-22c1e2b8cf8527c1e97de976f3dd46e7bee7cba3.tar.gz
redmine-22c1e2b8cf8527c1e97de976f3dd46e7bee7cba3.zip
Adds named scopes to replace custom finders.
* Adds watched_by class method in ActsAsWatchable * Adds Issue#recently_updated, Issue#with_limit and Issue#on_active_project #2482 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3557 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'vendor')
-rw-r--r--vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb b/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb
index c13da4fd4..f99f4a60d 100644
--- a/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb
+++ b/vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb
@@ -15,6 +15,10 @@ module Redmine
has_many :watchers, :as => :watchable, :dependent => :delete_all
has_many :watcher_users, :through => :watchers, :source => :user
+ named_scope :watched_by, lambda { |user_id|
+ { :include => :watchers,
+ :conditions => ["#{Watcher.table_name}.user_id = ?", user_id] }
+ }
attr_protected :watcher_ids, :watcher_user_ids
end
end
@@ -60,14 +64,7 @@ module Redmine
notified.collect(&:mail).compact
end
- module ClassMethods
- # Returns the objects that are watched by user
- def watched_by(user)
- find(:all,
- :include => :watchers,
- :conditions => ["#{Watcher.table_name}.user_id = ?", user.id])
- end
- end
+ module ClassMethods; end
end
end
end