From 94d7034792c20cc2e8b57a78f06bb7ead2aa38d6 Mon Sep 17 00:00:00 2001 From: cavis <ryancavis@gmail.com> Date: Wed, 28 Aug 2019 11:35:40 -0600 Subject: [PATCH] Safety 3rd --- lib/hal_api/controller/filtering.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hal_api/controller/filtering.rb b/lib/hal_api/controller/filtering.rb index ad7fcf5..4fa5596 100644 --- a/lib/hal_api/controller/filtering.rb +++ b/lib/hal_api/controller/filtering.rb @@ -62,7 +62,7 @@ def index_collection # add facets if defined, removing filters/facets with counts of 0 non_zero_facets = (filter_facets || {}).with_indifferent_access.tap do |hash| hash.each do |filter_key, facets| - hash[filter_key] = facets.select { |f| f.try(:[], :count) > 0 } + hash[filter_key] = facets.try(:select) { |f| f.try(:[], :count) > 0 } hash.delete(filter_key) if hash[filter_key].blank? end end