From e61b9b13515b0fb443a9a5431981ec92dd307f52 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Fri, 8 Feb 2013 09:17:58 +0100 Subject: [PATCH] uses a journal cache to render the history See the comment for some details. We should think about moving this into a different place like the controller or the User.current. Doing so would provide us with a request cache that can be reused for multiple purposes. However this might cause serious memory issues. --- app/views/issues/_history.rhtml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/views/issues/_history.rhtml b/app/views/issues/_history.rhtml index 793b69927f..e2f4d052e3 100644 --- a/app/views/issues/_history.rhtml +++ b/app/views/issues/_history.rhtml @@ -1,6 +1,15 @@ +<%# Uses a cache to render the history. The placeing of this object +is somewhat arbitrary. The important point is that it is not instantiated within +a journal as the cache could then not be used between all of an issue's journals. %> + +<% @journal_cache = Acts::Journalized::JournalObjectCache.new %> + <% for journal in journals %> - <%= render_journal issue, journal, :edit_permission => :edit_issue_notes, - :edit_own_permission => :edit_own_issue_notes %> + <%= render_journal issue, + journal, + :edit_permission => :edit_issue_notes, + :edit_own_permission => :edit_own_issue_notes, + :cache => @journal_cache %> <%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %> <% end %>