Topic: Conditonal Page Caching

I'm having problems trying to do page caching, but only if results are returned from a search. I don't want pages with no results to be cached.

I've tried doing the following in the controller method, but does not seem to work:

caches_page if @results.length > 0

I can't seem to get any results generated unless I include caches_pages :search at the top of the controller file. Any ideas?

Tech Cheat Sheets for Ruby, Rails, and much more!