[Rails] How to model attribute and attribute-value dependencies

Peter Ensch
Mon, 26 Jun 2006 17:45:30 -0000

I''m being sneaky and reposting this question; I got no anwsers perhaps
because I posted it over the w/end. I apologize for this but I''m
completely stumped and need either an answer or some clue about how my
approach is flawed. Thanks...

I have a rails application which has a table ''cells'' which
contains
some 80 or so attribute fields (related to the electrical
characteristics of macros that get hooked together and become micro-
chips).

I want to also store the legal values for many of those attribute
fields in another database table. The problem is that
1) the sub-set of attributes that apply to each cell is dependent on
the values of certain key cell attributes
(eg. if the value of the type attribute is ''I/O'', then certain
attribute fields will not apply)

and

2) the legal values of many of the attributes will vary depending on
the value of other attributes
(eg. if the value of the ''cell_type'' attribute is
''blah'' then the
legal values for attribute ''foo'' are [abc, def, ghi],
otherwise they
are [abc, ghi].

I get the whole notion of single inheritance tables which I will need
to use here; what I don''t get is how I can model these dependencies in
the database.

Can anyone share a similar need they had and how they handled it.

Thanks,
Peter

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