简体   繁体   English

跟踪客户对模型的特定偏好

[英]Rails customer specific preferences on model

I have a many-to-many relationship between two models: Customers and Products. 我在两个模型之间建立了多对多关系:客户和产品。 Many customers share the same database of products. 许多客户共享相同的产品数据库。

My questions is, what if I want to store Customer specific data for each product. 我的问题是,如果我想存储每种产品的客户特定数据该怎么办。 Like how many are in stock? 像有多少库存? My first instinct is to create some kind of wrapper model (eg Inventory) that refers to a product but would be customer specific. 我的第一个直觉是创建某种包装产品模型(例如,库存),该包装模型涉及一种产品,但将针对客户。 Is there a better way to do this? 有一个更好的方法吗?

Glad I could be of help. 很高兴我可以提供帮助。

Original Answer: Have you considered using a has many through association 原始答案:您是否考虑过使用具有许多关联性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM