should have just used rails and active record