Do you really need the flexible and dynamic scheme of option 2? As long as you only have a few settings I would stick to option 1. You can always migrate your data and move to scheme 2 if required.
/K 2010/1/25 Matt Jones <al2o...@gmail.com>: > > > On Jan 25, 1:28 am, Taylor Strait <li...@ruby-forum.com> wrote: >> I am trying to decide between two different database architectures for >> an application to manage properties. For capturing the property >> features, I have two options: a single model/table with all the features >> as fields, or a set of joined models - property, feature, feature data. >> (see attached ERD diagram) >> >> OPTION A >> Properties >> name >> address >> has_pool >> has_doorman >> has_etc. (a bunch of values, not all boolean) >> >> =OR= >> >> OPTION B >> Properties >> id >> name >> address >> >> Features >> id >> title >> featurable_type (polymorphic, in this case points to "property.id") >> data_type >> >> Feature_Data >> id >> feature_id >> featureable_id (polymorphic, in this case points to "property.id") >> > > Option B is certainly more flexible, but I'm unclear on why you have > these associations set up as polymorphic. Are you planning on having > other things with features besides Property? Note that subclasses of > Property don't count, as they'll work with plain associations. > > I'm also guessing there's at least one typo above - Feature shouldn't > actually be referring to Property, right? You've essentially got a > "decorated join table" situation, with FeatureData joining Property to > Feature. > > --Matt Jones > > -- > 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 rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.