summaryrefslogtreecommitdiffstats
path: root/app/views/my
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 /app/views/my
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 'app/views/my')
-rw-r--r--app/views/my/blocks/_issueswatched.rhtml9
1 files changed, 2 insertions, 7 deletions
diff --git a/app/views/my/blocks/_issueswatched.rhtml b/app/views/my/blocks/_issueswatched.rhtml
index 04f326c25..e48ec1662 100644
--- a/app/views/my/blocks/_issueswatched.rhtml
+++ b/app/views/my/blocks/_issueswatched.rhtml
@@ -1,10 +1,5 @@
-<h3><%=l(:label_watched_issues)%> (<%= Issue.visible.count(:include => :watchers,
- :conditions => ["#{Watcher.table_name}.user_id = ?", user.id]) %>)</h3>
-<% watched_issues = Issue.visible.find(:all,
- :include => [:status, :project, :tracker, :watchers],
- :limit => 10,
- :conditions => ["#{Watcher.table_name}.user_id = ?", user.id],
- :order => "#{Issue.table_name}.updated_on DESC") %>
+<h3><%=l(:label_watched_issues)%> (<%= Issue.visible.watched_by(user.id).count %>)</h3>
+<% watched_issues = Issue.visible.on_active_project.watched_by(user.id).recently_updated.with_limit(10) %>
<%= render :partial => 'issues/list_simple', :locals => { :issues => watched_issues } %>
<% if watched_issues.length > 0 %>