保留与ActiveRecord模型的名称

我非常重视命名,所以我觉得我的ActiveRecord模型的好名字很难。 然而,我经常想出一个名字,它与保留的名字有冲突,无论是在数据库还是Ruby或Rails。 模型或字段名称,如setgroup 。 有时候这个问题也不是很明显。 有没有我们不能在我们的模型名称中使用的名称列表和字段名称列表?

这里有几个资源,让你开始:

  1. Rails保留字 。 这个似乎是相当新的,最后更新于2010年2月。它甚至超越了rails,并列出了与SQL的一些常见命名冲突。
  2. 栏杆中的保留字 。 在这里生活的一个Heroku应用程序具有一个可search的保留栏的话语表。 这个内容似乎是用户pipe理的,所以任何有账户的人都可以添加一个新词。

列名称type也是保留的,不会显示在MyModel.methods列表中!

The single-table inheritance mechanism failed to locate the subclass: 'f'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Project.inheritance_column to use another column for that information.

有没有人有类似的, classtransactiongroup等名称的经验? 当我在我的数据库分类数据时,所有stream行的脑海….

打开一个rails控制台和一个MyModel.methodstypes

所有列出的方法都是保留字。