Cherry-pick changes to web/rails