Consolidated extension checking in routes.rb