From 675332033600daaadb5067cf622795cb1effc161 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Wed, 8 Jun 2016 16:27:54 +1000 Subject: [PATCH] Do not stomp address on create --- app/controllers/admin/enterprises_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/enterprises_controller.rb b/app/controllers/admin/enterprises_controller.rb index 377186b604..d88d30cb16 100644 --- a/app/controllers/admin/enterprises_controller.rb +++ b/app/controllers/admin/enterprises_controller.rb @@ -115,8 +115,8 @@ module Admin def build_resource_with_address enterprise = build_resource_without_address - enterprise.address = Spree::Address.new - enterprise.address.country = Spree::Country.find_by_id(Spree::Config[:default_country_id]) + enterprise.address ||= Spree::Address.new + enterprise.address.country ||= Spree::Country.find_by_id(Spree::Config[:default_country_id]) enterprise end alias_method_chain :build_resource, :address