Devise for Rails 4:为什么要将用户配置文件数据保留在与Devise用户模型表不同的表中 [英] Devise for Rails 4: why should you keep user profile data on a separate table to the Devise User models table

查看:57
本文介绍了Devise for Rails 4:为什么要将用户配置文件数据保留在与Devise用户模型表不同的表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是devise,根据文档建议,我有一个User模型(用于devise)和一个Profile模型,用于存储用户数据(例如姓名,职务等)。为什么只存储所有内容被认为不太好这些属性在设备用户模型表上。只是好奇。

I'm using devise and as per the documentations recommendations I have a User model (for devise) and a Profile model for user data such as names, job etc. Why is it considered "not so good" to just store all these attributes on the devise User model table. Just curious.

推荐答案

如果由外部源指定的表中添加字段可能会导致将来版本的gem发生迁移错误,如果gem更改了表定义。

Adding fields to tables specified by an external source could result in migration errors in future versions of the gem if the gem changes the table definition.

将用户表视为devise gem的实现细节。修改外部库的来源通常是个坏主意,因为它会使升级变得困难或不可能。

Think of the users table as an implementation detail of the devise gem. It's generally a bad idea to modify the source of an external library because it makes upgrades difficult or impossible.

这篇关于Devise for Rails 4:为什么要将用户配置文件数据保留在与Devise用户模型表不同的表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆