From 2d755ceeb55eab99b6c4bfc0513669ee287b607b Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Wed, 22 Aug 2018 19:46:00 -0500 Subject: [PATCH] fi logic --- app/views/content/display/_sidelinks.html.erb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/views/content/display/_sidelinks.html.erb b/app/views/content/display/_sidelinks.html.erb index f652af30..99c961ba 100644 --- a/app/views/content/display/_sidelinks.html.erb +++ b/app/views/content/display/_sidelinks.html.erb @@ -34,15 +34,9 @@ # Only show gallery tab if the content has any images next if @content.image_uploads.empty? else - # Only show other tabs if it has at least one piece of data in it, or it's a custom tab - next if fields.all? do |field| - if @content.respond_to?(field.name.to_sym) - value = @content.send(field.name.to_sym) - else - value = "custom field -- should always show" - end - - value.blank? + # Only show other tabs if it has at least one piece of data in it + next unless fields.any? do |field| + field.attribute_values.where(entity_id: @content.id).any? { |av| av.value.present? } end end %>