On 22 Feb 2009, at 00:20, Evan wrote:

>
> I've confused myself.
>
> I have three objects: level, product, part. Together they classify a
> repair type.
>
> - Replacing a part in a product has a level of difficulty associated
> with it.
> - The same part replaced in a different product has a different level
> of difficulty.
>
> How can I model an association among these?
>
> I have created a join model, "Repair class," and connected all three
> using :has_many through. However, this does not prevent multiple
> records where the part and product stay the same, but the level
> changes. In other words, I end up with multiple levels assigned to the
> same part/product combination which does not happen in the real world.
>

You might want to describe exactly what join model you have created

Personally my instinct would be to have a unique index on the join  
table enforcing that there is only one entry for each part/product pair

Fred
> What's the best way to proceed?
>
> Evan
> >


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