From: Jean-Philippe Lang Date: Mon, 28 Mar 2011 20:32:35 +0000 (+0000) Subject: Save 2 queries when displaying a root issue. X-Git-Tag: 1.2.0~601 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ba0c9069ed64db6b4fea7f3f1759dbe064c867f7;p=redmine.git Save 2 queries when displaying a root issue. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5244 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index f9f1c41ac..e4d35c217 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -57,11 +57,12 @@ module IssuesHelper def render_issue_subject_with_tree(issue) s = '' - issue.ancestors.each do |ancestor| + ancestors = issue.root? ? [] : issue.ancestors.all + ancestors.each do |ancestor| s << '
' + content_tag('p', link_to_issue(ancestor)) end s << '
' + content_tag('h3', h(issue.subject)) - s << '
' * (issue.ancestors.size + 1) + s << '
' * (ancestors.size + 1) s end