summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-24 10:45:45 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-24 10:45:45 +0000
commitec09c2c3caffe3f9b1e54974db9713d8a96d7a56 (patch)
tree7e536ca5805b128fee28285f29e106b26bcaf75a
parente3ffb1f23b778e95833dccaa4d121753a2bfa760 (diff)
downloadredmine-ec09c2c3caffe3f9b1e54974db9713d8a96d7a56.tar.gz
redmine-ec09c2c3caffe3f9b1e54974db9713d8a96d7a56.zip
Memorize journal details value name to display.
git-svn-id: http://svn.redmine.org/redmine/trunk@13938 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/helpers/issues_helper.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index c16ce5022..a618a68e7 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -405,14 +405,18 @@ module IssuesHelper
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)
- if record
- record.name.force_encoding('UTF-8')
- return record.name
+ @detail_value_name_by_reflection ||= Hash.new do |hash, key|
+ association = Issue.reflect_on_association(key.first.to_sym)
+ if association
+ record = association.class_name.constantize.find_by_id(key.last)
+ if record
+ record.name.force_encoding('UTF-8')
+ hash[key] = record.name
+ end
end
+ hash[key] ||= nil
end
+ @detail_value_name_by_reflection[[field, id]]
end
# Renders issue children recursively