Skip to content
This repository has been archived by the owner on Apr 17, 2020. It is now read-only.

fix clone_billing_address for new spree #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions app/models/spree/order_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@
before_validation :clone_shipping_address, :if => "Spree::AddressBook::Config[:disable_bill_address]"

def clone_shipping_address
if self.ship_address
self.bill_address = self.ship_address
if ship_address && bill_address.nil?
self.bill_address = ship_address.clone
else
bill_address.attributes = ship_address.attributes.except('id', 'updated_at', 'created_at')
end
true
end

def clone_billing_address
if self.bill_address
self.ship_address = self.bill_address
if bill_address && ship_address.nil?
self.ship_address = bill_address.clone
else
ship_address.attributes = bill_address.attributes.except('id', 'updated_at', 'created_at')
end
true
end
Expand Down