如何设计像google base这样具有动态属性的系统? 在 Ruby on Rails 中

发布于 2024-08-01 15:49:23 字数 279 浏览 4 评论 0原文

我想创建一个允许用户添加待售产品的应用程序。

我想让用户可以添加他/她喜欢的任何类型的产品,并让他们也为他们的产品创建存储和可搜索的属性 - 就像谷歌基地所做的那样。

有谁知道最好的方法来做到这一点,即对其进行建模。

我真的不想要每个类别都有一个表,因为这可能有 1000 个表。

做这个的最好方式是什么? 有人对此有好的/坏的经历吗?

有没有任何插件可以做到这一点?

任何帮助都会非常

感谢 里克

I am wanting to create an application that can allow users to add products for sale.

I want to make it so that a user can add whatever type of product he/she likes and let them also create stored and searchable attributes for their products - alot like google base does.

Does anyone know of the best way to do this ie model it.

I don't really want a table for each category as this would be possibly 1000s of tables.

What is the best way to do this? has anyone got good / bad experiences of this?

Is there any plugins that does this?

Any help would be great

thanks
rick

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

挽手叙旧 2024-08-08 15:49:23

听起来你想要的是一个标签系统。

如果您想要更灵活的东西,您可能需要考虑使用文档存储而不是数据库,例如 CouchDB

It sounds like what you want is a tag system.

If you want something more flexible you might want to look at using a document store instead of a database, for example CouchDB.

许你一世情深 2024-08-08 15:49:23

如果您不想将其保留在关系数据库中,我建议创建一个名为“Descriptor”的模型,其中包含要添加的项目的 ID、属性“Color”的名称和值“Red”。

为了帮助保持一致,您还可以构建预设的描述符组(对于汽车:品牌、型号、颜色),并为值输入文本字段提供自动完成功能。

If you don't want to keep this in a relational database I'd suggest creating a Model called "Descriptor" that would contain the ID of the item being added, the name of the attribute "Color" and the value "Red".

To help keeps things consistent you could also structure pre-set groups of descriptors (for cars: make, model, color) as well as provide auto-completes for the value entry text fields.

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