From 7f17ab5518d6f48c6da1674b5ec89923dd5e4677 Mon Sep 17 00:00:00 2001 From: Andy Brett Date: Fri, 18 Sep 2020 15:21:34 -0700 Subject: [PATCH] return empty array if distributor is blank --- app/helpers/enterprises_helper.rb | 2 -- app/services/distributor_shipping_methods.rb | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/enterprises_helper.rb b/app/helpers/enterprises_helper.rb index 8ca91e2c52bd..394f4ae1a07e 100644 --- a/app/helpers/enterprises_helper.rb +++ b/app/helpers/enterprises_helper.rb @@ -12,8 +12,6 @@ def current_customer end def available_shipping_methods - return [] if current_distributor.blank? - DistributorShippingMethods.shipping_methods(current_distributor, true, current_customer) end diff --git a/app/services/distributor_shipping_methods.rb b/app/services/distributor_shipping_methods.rb index 914c26786304..36f574f80f42 100644 --- a/app/services/distributor_shipping_methods.rb +++ b/app/services/distributor_shipping_methods.rb @@ -2,6 +2,8 @@ class DistributorShippingMethods def self.shipping_methods(distributor, checkout = false, customer = nil) + return [] if distributor.blank? + methods = if checkout distributor.shipping_methods.display_on_checkout.to_a else