switch to before_routes hook