Nested Form find or create inside of form

Good morning,

I haven’t done an autocomplete with a nested form in quite some time and can’t find any good references. I posted to SO here:

Basically I have two models Run and Patient. Run belongs_to patient and Patient has_many runs. Run accepts_nested_attributes for patient.

What I want to do is when creating a new run, have a select box that let’s me type out of the name of the patient, if they exist and it’s the right patient, use that ID in the form. If the patient does not exist, then create the nested association patient record. I’m hoping to do this with autocomplete too.

Any guidance is greatly appreciated.