Split the rails stuff into it's own file.