为不同产品提供不同的订单字段

发布于 2024-12-11 10:10:11 字数 390 浏览 3 评论 0原文

在我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

通知家属抬走 2024-12-18 10:10:11

“不同订单的所有字段”是什么意思?

如果每个产品都有任意数量的问题以及这些问题的有效答案,那么这些问答应该反映在其他模型中,并且每个产品都应该与其问答有关联。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文