Exercise 3: The Deliberate N+1 Setup — Possible Solution ==================================================================== WHY breadcrumb_for HAS A PERFORMANCE PROBLEM ------------------------------ Per this chapter, breadcrumb_for walks up the tree by repeatedly calling current.parent inside a while loop, one level at a time. Each call to .parent that hasn't already been loaded triggers its own separate database query, so building a breadcrumb for a page five levels deep issues one query per level instead of a single batched query for the whole ancestor chain - the classic N+1 query pattern. WHERE THIS IS MEANT TO BE CAUGHT AND FIXED ------------------------------ Per this chapter, this is left in place deliberately, matching the exact same pattern both sibling courses built into their own Chapter 4 breadcrumb code on purpose. It's meant to be caught and fixed live in Chapter 6, where ActiveRecord's own eager-loading mechanism is introduced. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains that the loop's repeated current.parent calls trigger one database query per tree level, and correctly identifies Chapter 6 as the point where this deliberately-planted problem is meant to be caught and resolved, matching the same running motif already used in the sibling courses.