How to use project parent name?
Added by Joseph Rossi over 12 years ago
I would like to display the project parent name in RedMine emails. So I edited the email templates (issue.add.html.erb for example) and it works well for sub-projects. But when I add a new issue or edit one in a project at the root level, the site returns an error 500:
ActionView::TemplateError (undefined method `name' for nil:NilClass) on line #1 of app/views/mailer/issue_add.html.erb
So I would like to include an if statement (or a while, or something similar) to tell RedMine to include project parent name only if the project is a subject. Something like:
<h1> <% if issue.project.parent.name exists %> <%=h(@issue.project.parent.name)%> » %> <% end %> <%=h(@issue.project.name)%> </h1>
Can somebody tell me how to do this in ruby? Thanks.