这是个好主意,作一简介自己的模式与HAS_ONE / belongs_to的与用户模型关联,还是应该配置文件的属性只是在用户数据库列?
Is it a good idea to make a profile its own model with a has_one/belongs_to association with the User model, or should the attributes of a profile just be columns in the user database?
推荐答案这是真的,需要由它怎样被使用来决定一个设计决策。
This is really a design decision that needs to be decided by how its going to be used.
我最近创建一个具有用户和轮廓模式与用户分离总是具有程序的个人资料的约束。
I've recently created a program that has a 'user' and 'profile' model separated with the 'user' always having the a 'profile' constraint.
我就是这么做的,因为没有什么在用户表中的其他然后登录用户或允许管理员看到/做某些事情所需的信息。
I did it this way since there is nothing in the 'user' table other then information needed to login a user or allow the admin to see/do certain things.
鉴于个人资料模式包含一个可查看和其他成员检索数据。
Whereas the 'profile' model contains data that can be viewed and searched on by other members.
但同样,它的你有一个设计决策基于数据将被如何使用做。
But again, its a design decision you have to make based on how the data will be used.
更多推荐
简介模型关联问题
发布评论