Partial Caching is a great way to get some major page speed improvements without a lot of work. But if you forget a
touch: true on one of your associations, or your template dependencies aren’t working right, your cached partials won’t get updated.
Since the development environment usually runs with caching disabled, you’ll only discover this in staging, or even worse, production! To debug the problem, you’ll need to reproduce it in development mode by setting
true. You’ll have to do this every time you have to debug cache problems, and you’ll have to remember to change it back before you check in. I hate to do that kind of stuff, so when I start a new project, I set it to this instead:
That way, I can enable caching whenever I need to by starting my Rails server with
rails server will run with caching disabled, as usual.
As you start tweaking configuration parameters more often, this pattern of turning hardcoded parameters into environment variables can save you a lot of time and fiddling. Give it a try in your own projects!