From: Jean-Philippe Lang Date: Thu, 3 Jan 2013 13:39:04 +0000 (+0000) Subject: Don't do any query if id is not present. X-Git-Tag: 2.3.0~363 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=503933c585885adaf5c73957d033eb595b13beca;p=redmine.git Don't do any query if id is not present. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11105 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index deb001273..11065ecc2 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -347,6 +347,9 @@ module IssuesHelper # Find the name of an associated record stored in the field attribute def find_name_by_reflection(field, id) + unless id.present? + return nil + end association = Issue.reflect_on_association(field.to_sym) if association record = association.class_name.constantize.find_by_id(id)