Hacking rails 3.1

The announcement that we have migrated to Rails 3.1 may have to be delayed... and I'm a little tired.

So I've just finished DOWNGRADING my site from rails 3.1 to version 3.0.3. Why would I do such a thing?

Dreamhost. The engines just cannae do it cap'n.

Having battled with 3.1 installation, I eventually gave up and downgraded. I deleted my Gemfile and Gemfile.lock, I put some require statements in for haml, and then I got stuck: Sprockets.

I did try installing sprockets, honest. But in the end it all seemed to conspire against me, and when it started complaining about VM size being too large, I gave up and crafted my own poor man's sprockets.

Since best practice dictates that you precompile all your code before you start, I did that. This left me with a folder like this:

$ ls public/assets
... etc

So instead of sprockets, I have a new entry in my config.ru, the core of which is this:

filename, filetype = env["REQUEST_URI"].to_s.scan(/([^\/]+)\.([^\.]+)$/).flatten
filename = Dir[::File.expand_path("../public/assets/#{filename}-*.#{filetype}", __FILE__)].first

Oh yes I did. Asset pipeline, eat your heart out.

I'm off to bed now. I'm gonna add more features to the site soon, and when Dreamhost get their act together, I may even upgrade to 3.1 proper. Sweet nightmares all!

P.S: I will re-read this in the cold light of morning and fix any mistakes. Enjoy!