Thomas
Thomas

Reputation: 2386

rails different order fields for different products

In my rails application, I would like different products to have different types of questions asked on the order fields. Whats the best way to accomplish this? Should i just make one big order model with all the fields for the different orders, and have only the fields pertaining to the product filled out? For example, if you check out the product fire extinguisher, i would like it to ask:

have you ever used a fire extinguisher before?

or if your checking out a car seat, i would like it to ask

do you want the fire department to install it for you? 

the example i gave you is just basic, but it will ask a lot more questions than that pertaining to the product when it is being checked out. what do you think the best way to accomplish this is?

Upvotes: 0

Views: 80

Answers (1)

Dave Newton
Dave Newton

Reputation: 160321

What do you mean, "with all the fields for the different orders"?

If each product has an arbitrary number of questions, and valid answers for that questions, those Q&A should be reflected in additional models, and each product should have an association to its Q&A.

Upvotes: 1

Related Questions