I have two very similar models Pretreatment and Diagnosis, that belong to the model Patient:
class Pretreatment < ActiveRecord::Base
belongs_to :patient
a
There are a few ways of doing this:
fields_for
works is you have a form_for
for the parent model and within it you can place fields_for
the models which belong to the parent. A good example is given in the Rails Docs$("form #new_pretreatments").submit();
and the same for the Diagnosis once a button is clicked.