ruby logic in route handler em