I'm trying to use 'fields_for' in a form. I want the same form to support both the creation of new obejcts as well as the editing of old ones. So - in my controller, sometimes I will pass to the form an object that already exists in my database and has an id and other times I will pass it a newly created instance of an object that does not yet exist in the database and does not have an id.
I want the params hash to have the id of the object if its available, so - i'm using fields_for 'vehicle_record[]', as opposed to fields for 'vehicle_record'. Also, when I am using the form to render an existing object, i'd like it to automatically display the values of the existing parameters wherever I use f.text_field. And - i'd like it to package up those params that exist into a nice params hash. When my controller passes the view an existing object, I submit the form and everything's dandy. When my controller passes the view a new object that does not have an id, then I get the error message regarding conflicting container types. Why? Can I use the same form to handle both new and edited objects and at the same time to work as expected with f.text_field? Am I going about it the wrong way? I spent quite a bit of time reading the tutorials on the web but still don't understand what's going on here. Any guidance appreciated! Yoram --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

