From 71076d36a172bd42449e191d3d669d8924a4cab3 Mon Sep 17 00:00:00 2001 From: Andy Brett Date: Tue, 24 Aug 2021 11:54:02 -0700 Subject: [PATCH] favor `dig` to protect against nils --- app/controllers/split_checkout_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/split_checkout_controller.rb b/app/controllers/split_checkout_controller.rb index fe07100dc9..85c15e1425 100644 --- a/app/controllers/split_checkout_controller.rb +++ b/app/controllers/split_checkout_controller.rb @@ -65,13 +65,13 @@ class SplitCheckoutController < ::BaseController @shipping_method_id = @shipping_method.id end - @ship_address_same_as_billing = params[:order]["Checkout.ship_address_same_as_billing"] + @ship_address_same_as_billing = params.dig(:order, "Checkout.ship_address_same_as_billing") end def populate_ship_address_params - return unless params[:order][:ship_address_attributes].present? && - params[:order][:bill_address_attributes].present? - + return unless params.dig(:order, :ship_address_attributes).present? && + params.dig(:order, :bill_address_attributes).present? + address_attrs = [ :firstname, :lastname,