adapted to rails 3 type hooks, fixed error in route