I have a controller that's creating model objects from XML input. Something like:
<status-report> <completed type="boolean">true</completed> <person> <name>Scott</name> </person> </status-report>
I have two models, StatusReport and Person.
I want to create a new Person iff there is not already one with that name. Then, link that Person to this StatusReport.
The built-in accept_nested_attributes_for doesn't work for me since it will always create a new Person unless I provide an id to an existing one.
I have full control over the XML input. What I don't have is a good way for it to include the id of an existing Person.
Right now I have a fat controller explicitly looking for a Person, then doing Person.create! if needed. I'm sure there's a better way.