From ec8329069d36cc6aa444c8a48b6b34a3e8f5c9d2 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Tue, 21 Jul 2026 21:34:14 +0200 Subject: Extract Page#headline_asset The same related_assets.find_by(headline: true) query was written by hand in three places -- content_helper, nodes#show, and the chapter teaser partial (which was still using assets.first, the old position-based rule, until now). Collapsed to one method, one query. --- app/helpers/content_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/helpers') diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb index b3c6bad1..459d9e01 100644 --- a/app/helpers/content_helper.rb +++ b/app/helpers/content_helper.rb @@ -53,7 +53,7 @@ module ContentHelper end def headline_image - @headline_asset = @page.related_assets.find_by(headline: true)&.asset + @headline_asset = @page.headline_asset render :partial => 'content/headline_image' if @headline_asset || @page.assets.images.any? end -- cgit v1.3