On 16 Apr 2009, at 15:36, bingo bob wrote:

>
> I'd like to do something like this..in English, a Teacher is in a town
> (easy).
>
> They also can have qualifications (from none to lots). How do I do  
> this,
> I mean I can see a Teacher could have a QualificationID field which
> could have could contain numbers like 3,4,6 (meaning they have
> qualifications of X, Y and Z). How do I do it in rails associations?
>
sounds like you need a has many through (or has and belongs to many)  
between teachers and qualifications, since I assume that many teachers  
may have the same qualification. This join model could also hold data  
like when the qualification was awarded etc.

Fred
> Teacher (Belongs to a Location)
> - FirstName
> - LastName
> - EmailAddress
> - MobilePhoneNumber
> - LocationID
> - QualificationID(s) <---
>
> Location (Has Many Teachers)
> - Name
>
> Qualification <--- what to do here?
> - Name
>
> --------------
>
> Ultimately I'd like to do things like Teacher.Location.name (easy).
>
> I'd like to do Teacher.Qualifications also (Not sure how to express  
> this
> but you get the idea).
>
> Any help appreciated....
> -- 
> 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 [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