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
This commit is contained in:
Jean-Philippe Lang 2013-01-03 13:39:04 +00:00
parent e4f0b9a9f9
commit 503933c585
1 changed files with 3 additions and 0 deletions

View File

@ -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)