Dean Chester
2012-Jun-17 14:48 UTC
The rails way to develop a multi product type shopping cart
Hi, I''m developing an application which has to manage many types of products. But I can''t think what the best approach in rails is on how to implement them. Here is a selection of some of the products (with some data types) that the software will have to manage: Speaker Make - String Model - String Wattage - Integer Price - Decimal Light Make - String Model - String Wattage - Integer Price - Decimal Microphone Make - String Model - String Use - Choice of: Instrumental, Vocal, Versatile Price - Decimal Cable Length - Decimal Connector 1 - String Connector 2 - String Price - Decimal Stand Type - Choice of: Microphone, Speaker Height - Decimal Boom - Boolean Price - Decimal Ways I have thought about the design: - An individual model for each type of product then a polymorphic association in the cart so that it can handle all the types of equipment. - A single product model that has fields for all types of equipment with a type field which can be checked when ever the product is used. - A product model with a price attribute then every type of product extends that model. But what is the best way in rails to handle these different types of products? TIA, Dean -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/XEOR_gtOwUkJ. 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.