Rails: Added related models to a "new" model... ?
The topic doesn't quite explain what I'm trying to do. Picture this...
I have 2 Models - Manufacturers and Types. Manufacturers have many Types. Rather than forcing the user to create the two on seperate pages I'm aiming to combine them in such a way that I can (using RESTful actions) generate a new Manufacturer and add Types to it before the Manufacturer is saved to the database. The idea is the Types don't actually get saved until the Manufacturer is saved.
So my 'new' Manufacturer view contains a AJAX form to add Types but within the controller action I can't seem to figure out how to add these new Types to the Manufacturer model in the view.
Is this even possible? I figured that I could somehow create the Type and push it to the Manufacturer.types but I don't know how to pass the Manufacturer model along to do this.
Any help would be much appreciated!