Fixing the Rails 3 Fragment Cache Path
Let’s say you were using Rails 2.3.x, and you made the (wise) decision to implement heavy fragment caching. Then let’s say that you updated to Rails 3.x. At that point, you probably noticed that Rails 3 does something seriously annoying with the paths where it caches fragments.
In Rails 2, doing this:
<% cache('posts/123/123456/main') do %>
Gave you a cache file that looks like this:
RAILS_ROOT/tmp/cache/views/posts/123/123456/main.cache
However, in Rails 3, the same cache code results in a cache file that looks like this:
RAILS_ROOT/tmp/cache/925/AB2/posts%2F123%2F123456%2Fmain
WTH? That’s not documented in the Rails 3 API. So what’s going on, and how do you make Rails 3′s fragment caching work like it used to instead of using those crazy hash subdirectories? Read on!


If you’re like me, you’ve got a Rails 2.3.x application running on Ruby 1.8.x – or perhaps Ruby Enterprise Edition. Well, that’s all fine and dandy, but Ruby 1.9.2 is about twice as fast as even REE 1.8.7. So, you’ll probably want to upgrade to the new version of Ruby.
Okay, I know this one has been done like 8 bazillion times, but this method of creating a drop shadow on elements in a web page via CSS and a 1 pixel by 1 pixel transparent PNG file actually DOES work.
Some of you may recall my earlier post 

If you have a Rails app that sends e-mails, you are probably using ActionMailer. Unfortunately, starting with Rails 2.2.2, you may have encountered a wonderfully annoying little error that looks like this:
So you’ve decided to be supercool and use
