Spree Commerce

Try It Now

Address Refactoring

Posted on April 08, 2009 by Sean Schofield

The edge version of Spree now contains some additional address refactorings. Billing and shipping addresses are now directly available through the Order model instead of accessing them indirectly through Shipment and CreditcardPayment. There are also new migrations to help move everything around in the database. Of course, you should back up any sensitive production data before running them.

Currently there is no way to edit the billing and shipping address once the order is completed. If you change these through the admin inteface you are actually editing the address of the creditcard and shipment respectively. We just need to sort through whether the original address values can be changed or if they should be preserved. If we allow them to be changed, presumably the shipments and creditcards would change as well but that might not always be the desired outcome. Take a look at the updated online demo to see how this is working and post your thoughts on spree-user.

These changes move us closer to a new address book feature that StephP is working on. They also make it easier to simplify the checkout form using the new nested attributes functionality of Rails 2.3.