Nested Form find or create inside of form

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Nested Form find or create inside of form

nynhex
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: https://stackoverflow.com/questions/44232005/rails-5-nested-form-find-or-create

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.

Thanks!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4E680D8E-059E-4B1A-8A18-544ABE8EEB7D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...