From be525d1d678ed99cf5b170fec02553a5d1ea2ea0 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Sun, 9 Jun 2024 15:40:58 -0700 Subject: [PATCH] Oops, fix bug with empty subtitles in Item Getting Guide Oh weird, even with `flush: true`, `content_for` will ignore an empty block and *not* flush out the previous content. This could cause rows whose subtitles *should* have been empty (e.g. no NC trade value) to display the previous row's value instead. Let's make this whole situation a bit more robust by having the *template* clear out the subtitle right before calling the block. That way, a previous row's value *can't* get in, no matter what. --- app/views/items/_item_list_row.html.haml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/items/_item_list_row.html.haml b/app/views/items/_item_list_row.html.haml index 7e26c84f..4ee172bf 100644 --- a/app/views/items/_item_list_row.html.haml +++ b/app/views/items/_item_list_row.html.haml @@ -1,4 +1,6 @@ --# Run the block first, so we can get the subtitle content if provided! +-# Run the block first, so we can get the subtitle content if provided! Clear +-# out any old values beforehand, too. +- content_for :subtitle, "", flush: true - content = yield - subtitle = yield :subtitle