Rails code clean up