I’m struggling to see the natural solution to this with a nod to
resources and keeping things restful.
The problem is based around a Customer model with a fairly standard
resource based controller (new, create, edit…)
The registration is really a two step process:
First enter a postcode/zip and then search national database of
addresses to offer selection of possible addresses for this postcode/
zip in a select box.
User then selects an address and proceeds to what is essentially
the /customers/new action with the address fields already populated,
just requiring customer name and contact details to be filled in.
I don’t really want the new Customer object created until the final
stage of name and contact details entry.
I was thinking maybe a NewCustomerAddress resource with the ‘index’
action presenting the postcode/zip search box which submits to the
‘new’ action which looks up the submited postcode and renders
available addresses in a select box.
The user then selects the suitable address and submits the form, which
requests the Customer ‘new’ action. Before rendering customer/new it
adds the address detail to the new Customer object to be displayed in
the form (user may then also tweak address if neccessary).
Am I using resources correctly regarding the NewCustomerAddress? Could
it be bundled in to the Customer resource?