Rails 4.0.0.rc1

This is largely thanks to @nasmorn. I just added a few tweaks to #13, mainly for backwards compatibility.