]> source.dussan.org Git - redmine.git/commitdiff
Saves an extra SQL query on each request.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 16 Mar 2011 19:26:07 +0000 (19:26 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 16 Mar 2011 19:26:07 +0000 (19:26 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5153 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb

index 914efd25a98f7f1a4c659410bb48c32fd2dab3cc..35c8a4014b55071db067cdcb263897658cee2e8e 100644 (file)
@@ -223,8 +223,7 @@ module ApplicationHelper
   
   # Renders the project quick-jump box
   def render_project_jump_box
-    # Retrieve them now to avoid a COUNT query
-    projects = User.current.projects.all
+    projects = User.current.memberships.collect(&:project).compact.uniq
     if projects.any?
       s = '<select onchange="if (this.value != \'\') { window.location = this.value; }">' +
             "<option value=''>#{ l(:label_jump_to_a_project) }</option>" +