Make this method handle the case where the variants hash passed is nil

This fixes a spec in the rails 4 branch
This commit is contained in:
Luis Ramos
2020-03-10 18:41:26 +00:00
parent 7585e3d1d6
commit 03246d425d

View File

@@ -184,6 +184,8 @@ module OpenFoodNetwork
end
def variants_to_a(variants)
return [] unless variants
variants.select { |_k, v| v }.keys.map(&:to_i)
end
end