Profile model association question

ぐ巨炮叔叔 提交于 2019-12-11 07:06:32

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/5365834/profile-model-association-question

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!