Use scope instead of constraints to define routes.
It works the same with rails 3 and rails 4.