为不同产品提供不同的订单字段
在我的 Rails 应用程序中,我希望不同的产品在订单字段上提出不同类型的问题。实现这一目标的最佳方法是什么?我是否应该制作一个包含不同订单的所有字段的大订单模型,并且只填写与产品相关的字段?例如,如果您查看产品灭火器
,我希望它询问:
have you ever used a fire extinguisher before?
或者如果您查看汽车座椅
,我希望它询问
do you want the fire department to install it for you?
示例我给你的只是基本的,但在检查时它会问比产品有关的更多问题。您认为实现这一目标的最佳方法是什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“不同订单的所有字段”是什么意思?
如果每个产品都有任意数量的问题以及这些问题的有效答案,那么这些问答应该反映在其他模型中,并且每个产品都应该与其问答有关联。
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.