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