📝
article
feed.thoughtbot.com
·
December 2, 2026
When the N+1 fix becomes the problem
I fixed an ActionText N+1 by preloading rich text bodies. Later I deleted that preload, and the home page went from around 10 seconds to 360 ms. Both changes were correct. The first fix: Preload everything Our list pages show a card per article, with a short excerpt on each card. The card partial had one line for that: <%= rich_text_preview ( article . body , length: 120 ) %> The helper renders the body with to_s , strips the HTML with Nokogiri, and truncates the text to 120 characters....
Read on feed.thoughtbot.com →