开发者

What table fields would I need here?

I want to create a commenting model with a twist. I want there to be multiple commenting columns like on hunch.com, except that a user can decide how many columns there should be. Also, a user can decide the title for each column.

This is rather dynamic, so how would I set up my tables f开发者_StackOverflow中文版or this?


Seems like a perfect use case for NoSQL. I'd use something like CouchDB or Mongo here. Since there you don't have a schema you can add the attributes as needed.


Since you cannot really change the attributes of a model, if you want to create dynamic model attributes, you can have 3 models :

User
Attribute
UserAttribute

Now, you can add as many attributes are you want (Attribute is the static representation of an attribute). Then, a user can have many attributes through user_attributes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜