Stop building routes dynamically to avoid N+1 queries
Right now Routable#route
will dynamically build a route if one doesn't exist. That's convenient to avoid data migrations, but when querying across many projects this introduces a potential N+1 query since we always have to attempt to build a project route even if it already exists. Right now we are mitigating this problem by caching the routes in RequestStore
.
It seems to me we're better off filling in a valid route for every project rather than trying to build it on-the-fly.