]> source.dussan.org Git - redmine.git/commitdiff
Memorize journal details value name to display.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 24 Jan 2015 10:45:45 +0000 (10:45 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 24 Jan 2015 10:45:45 +0000 (10:45 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@13938 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/issues_helper.rb

index c16ce5022deb78033044adddb1b4091bd8933f12..a618a68e77dfd0f44e7f7880fedab14bd857a889 100644 (file)
@@ -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