Ruby on Rails Thursday, December 30, 2010

Bo Pritchard wrote in post #971530:
> Here are my tables
>
> patients
> id name
> 1 Bob
> 2 Carol
> 3 Ted
> 4 Reggie
>
> families
> family_id patient_id
> 1 1
> 1 2
> 2 3
> 2 4
>
> How do I structure the model associations so that I can
> @patient.family.patient[0].name?

By writing that method chain, you've just about answered your own
question. Try it!

>
> Make sense?

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org

--
Posted via http://www.ruby-forum.com/.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment