Peter Ensch
2006-Jun-25 19:09 UTC
[Rails] storing attribute legal values in model and/or database
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 are hooked together, instantiated in silicon and become microchips). 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 library attribute is ''xx00'', 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/.