Hello,
I am developing an application that will have 100's of model classes
each derived from a single source class. Each model will have 4 similar
attributes but then have about a dozen unique ones each. I looked into
using STI but balked at creating tables with a 1000 columns. I then
looked at using inherits_from and creating an new table for each class
that holds the new class columns. Problem is, I'll end up with 100's of
tables, which also does not appeal to me.
My third solution, the one I am asking advice on, is this.
I create a single table with the 4 common columns and a dozen columns
with names such as float1, float2, float3, ... , string1, string2, ..
etc. Creating enough columns of each type to cover my largest subclass.
Then I use STI and for each class I map the generic columns to the nicer
names inside the subclasses. So in one class float1 may be miles/hour
while in another class it might be turkeys/hectare.
Does this sound like a reasonable approach?
Also, how would I map the generic names to nice names in my subclasses?
(I am a RoR noob)
And of course, does anyone see a much better way to do what I have
proposed?
Thank you,
Ryan Glover
···
--
Posted via http://www.ruby-forum.com/.