Today for the second time in a short while I’ve come upon a case where
I’d like to have a “model” without a primary key. Instances of such a
model wouldn’t have an identity above the unique combination of (part
of) their attribute values.
The cases I’ve come up with involve expressing facts about two or more
related objects. They can be thought of as n-ary associations, in a
sense, generalizations of habtm.
Here’s an example: There are multiple compilers, each of which
potentially runs on many host systems and can compile code for many
target systems (depending on host system!).
I’d like to express facts and queries like these
- compiler c running on host OS h can compile for target OS t
- find all compilers that run on host OS h and compile for target OS t
- find all compilers that match some other condition and run on host OS
h
Much of this can be kludged with :through associations, but it doesn’t
feel right to me as these involve full-fledged association models with
an identity independent of their attribute values.
I’m very much interested in suggestions.
Michael
–
Michael S.
mailto:[email protected]
http://www.schuerig.de/michael/