Making things DRY: RESTful address controller

Hello list,

I’m developing an e-commerce application, and the Checkout controller has an edit_address and create_addresses method. I’m not expert in any RESTful-based architecture (including the Rails implementation) but this just doesn’t feel right. I would rather have a Addresses controller to create and edit addresses, create a resource out of it, and nest it as needed for any other resource that needs it (by making it polymorphic, something like this: http://www.pathf.com/blogs/2008/07/drying-up-rails-controllers-polymorphic-and-super-controllers/).

To edit an address, I would then just POST to http://url/addresses/id instead of POSTing to checkout/edit_address/. Much simpler and DRY. Would also clean up the checkout controller, removing from it the responsibilities of editing addresses…

However, in one of the checkout steps, I need to create two addresses in only one request (billing and shipping addresses) - as there is a screen with two addresses forms so the user can input their addresses. These addresses need to be created in the account (account has one billing address and has one shipping address). I would rather not create an edit_addresses action in the addresses polymorphic controller, but I see no other way of receiving the input of this form and updating both addresses at the same time.

What do you think?

Thanks,

Marcelo.