Vladimir Penkin
2009-Dec-10 17:48 UTC
Model types implementations: EAV-attributes VS flat tables.
Hello all. I''m new in rails, and I''ve having some troubles about deisgning my database and rails models. I need to store different types of places(entertainments, hotels, sights) in database. This are different types if one entity, and they have different sets of attributes. So my question is what is a proper way to design: EAV-attributes or flat tables for each one entity. This how I see each one: EAV-attributes - needs 3 more tables: place_type, type_attributes, attributes_values which will store attirbutes inside and join in to model dynamicaly. The pros of this method is that I can easily add/ remove attributes. Also I can easily filter places just by type, but having pain joining attributes for each entity Flat tables - needs extra tables for each one type. It''s the easiest way to store different types but needs a lot of relations tables because of my model. I also store user-place relations so I need different tables for each relation. Also I have translations which also complicates relations. -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.