From d38167fd14de267a221c76ca69b8775f34adb2f4 Mon Sep 17 00:00:00 2001 From: jenkr55 Date: Sun, 8 Apr 2018 09:47:15 -0500 Subject: [PATCH 1/2] Only show planting suggestion if theres a match --- app/views/harvests/_planting.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/harvests/_planting.haml b/app/views/harvests/_planting.haml index 085f24c7c..c58f5f6f4 100644 --- a/app/views/harvests/_planting.haml +++ b/app/views/harvests/_planting.haml @@ -3,7 +3,7 @@ planting_path(@harvest.planting) in = link_to @harvest.planting.garden, garden_path(@harvest.planting.garden) -- elsif @matching_plantings && @harvest.owner == current_member +- elsif @matching_plantings.any? && @harvest.owner == current_member Is this from one of these plantings? = form_for(@harvest) do |f| - @matching_plantings.each do |planting| From 9c0ddb61e7406a042dadf1b1ac751156a0f24fce Mon Sep 17 00:00:00 2001 From: jenkr55 Date: Sun, 8 Apr 2018 10:17:06 -0500 Subject: [PATCH 2/2] Prevent error when @matching_plantings is nil --- app/views/harvests/_planting.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/harvests/_planting.haml b/app/views/harvests/_planting.haml index c58f5f6f4..6e6ba03c2 100644 --- a/app/views/harvests/_planting.haml +++ b/app/views/harvests/_planting.haml @@ -3,7 +3,7 @@ planting_path(@harvest.planting) in = link_to @harvest.planting.garden, garden_path(@harvest.planting.garden) -- elsif @matching_plantings.any? && @harvest.owner == current_member +- elsif @matching_plantings && @matching_plantings.any? && @harvest.owner == current_member Is this from one of these plantings? = form_for(@harvest) do |f| - @matching_plantings.each do |planting|