Migrate to Rails

This PR is in progress, and should contain discussion and requests.