Add a save function, and update rails template