opf/openproject — pull request #26 by ulferts (2013-02-11 10:28:10+00:00)
Title: Perf/issue show history

Employs the journal cache added by https://github.com/opf/openproject/pull/25 to render an issue's history.

Beware: This request actually incorporates the commits found in https://github.com/opf/openproject/pull/25. I choose to separate the two to make a clean cut between what was changed on a general level from optimizations for a specific case.

The cache is still the simple cache offered by acts_as_journalized which is a not yet optimized as much as it could be (see https://github.com/opf/openproject/pull/25).

I struggled with the right placement for the cache's instance. In order to reuse the cache between formatters we have to keep a reference to it separate from them. In addition, the cache should only be valid for one request and it should not be placed inside the journaled object, the issue. The later would be a nice place from a cleanliness perspective but require each formatter to load the same instance of the issue which would somehow create the original problem all over again.

The cache is stored inside the view, hence. As the history is incapsulated inside a partial, this transports the meaning of the cache nicely.