mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Tidy up building default address objects
This commit is contained in:
@@ -14,9 +14,7 @@ module Spree
|
||||
end
|
||||
|
||||
def edit
|
||||
country_id = Address.default.country.id
|
||||
@order.build_bill_address(country_id: country_id) if @order.bill_address.nil?
|
||||
@order.build_ship_address(country_id: country_id) if @order.ship_address.nil?
|
||||
build_addresses
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -44,6 +42,12 @@ module Spree
|
||||
|
||||
private
|
||||
|
||||
def build_addresses
|
||||
country_id = Address.default.country.id
|
||||
@order.build_bill_address(country_id: country_id) if @order.bill_address.nil?
|
||||
@order.build_ship_address(country_id: country_id) if @order.ship_address.nil?
|
||||
end
|
||||
|
||||
def refresh_shipment_rates
|
||||
@order.shipments.map(&:refresh_rates)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user