制定实施方案。 Admin 作为单独的表或列
可能我的问题是理论上的,但我想知道您对 devise 作为单独的表或用户表中的列的用法有何看法。
一些基本点很值得讨论: 1. 在什么情况下您会选择这个或其他实现? 2. devise在实现为单独的表时添加了哪些方法? 3. 您认为实施该设计最简单的方法是什么?为什么?
先感谢您
May be my question is to theoretical, but I would like to know your opinion on what is the usage of devise as a separate table, or a column in a Users table.
Some basic point would be great to discuss:
1. In what situation would you choose this or the other implementation?
2. What methods does devise add when implementing it as a seperate table?
3. What do you find the easiest way to implement devise, and why?
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然,您可以在每个应用程序中创建 2 个或更多设计模型。
但在许多情况下'单表继承(STI)'可能对你有很大帮助。
如果数据没有不同并且具有相同的行为,则很好。
它将使您有时能够轻松处理复杂的数据。
但是当每个角色存储不同的数据时,表中会创建大量空列,并且查询时间较慢。
如果您想自定义角色可以执行的更多操作,那么您可以使用 Cancan 它将帮助您的生活更轻松。
PS。在现实生活中,规范化的数据并不意味着它有良好的数据库设计。
Sure you can do 2 or more devise model in each application.
But in many case 'Single Table Inheritance(STI)' might help you a lot.
Is good if data is not different and have a same behavior.
It will make you easy to handle complex data sometimes.
But there is create a lot of null column in table when each role is store different data and it have a slower query time.
If you want to customize much more what is role can do then you Devise with Cancan it will help you life easier.
PS. In real life normalized data is not mean it have a good database design.