The typical way I’d write code that used fragment caching looked like this.
The fragment caching adds extra work to the controller code to avoid doing the work that didn’t need to be done due to the data being cached. This is kind of messy.
I’ve also written code like this to avoid the above cruftiness
From my previous post about when the named_scope queries actually run it occurred to me that the following code now works correctly.
The Named Scope code allows my controllers to once again not care about how the View code works.