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.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to