On Jan 25, 1:28 am, Taylor Strait <[email protected]> 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

