On Mar 1, 11:13 pm, zindelo <[email protected]> wrote:
> Sorry I didn't add the patients in there, but I would need the three tables.
> What I'm after is how to represent this data in a form. There is a ton of
> info out there about associations, but not much related to using the data in
> a join table like the appointment_date field. It seems like the physician
> form and the patient form would be very similar and both are needed, storing
> the appointment_date in the join table so both can use.

It doesn't sound like you need a has_many :through setup here for
Physician at least. One way to set this up is Phyisician has_many
Patients and Physician has _many Appointments. Appointments and
Patients both belong_to Physician. You could add that Patient has_one
or has_many Appointment through Physician.

>
> If you use a fields_for to list out the appointments using :appointments,
> how do you reference to the patient name? The patient name doesn't need to
> be editable, but the only field I can access is user_id from the
> appointments table and not name from the patients table. Hope that makes

Usage of fields_for is fairy well documented. You should look at the
usage of accepts_nested_attributes_for directive for editing nested
records on the same form. If you want to do something dynamically on
the client side with nested records a good article is here
http://railsforum.com/viewtopic.php?id=28447.

> better sense.  Thanks

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