与ActiveRecord模型保留名称 [英] Reserved names with ActiveRecord models
本文介绍了与ActiveRecord模型保留名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我把命名pretty的重视,所以我觉得pretty的好好的,我的ActiveRecord模型好名字。不过,我经常拿出一个名称,它与保留名称有些冲突,无论是在数据库或Ruby或Rails的。如模式或字段名称设置
或组
。有时候问题不是显而易见的两种。有没有名字,我们不能在我们的模型名称使用列表的地方,并为域名列表?
I take naming pretty seriously, so I think pretty hard about good names for my ActiveRecord models. However, I frequently come up with a name and it has some conflict with a reserved name, either in the database or Ruby or Rails. Model or field names like set
or group
. Sometimes the issue isn't immediately apparent either. Is there a list somewhere of names we can't use in our model names and a list for field names?
推荐答案
下面是一对夫妇的资源,让你开始:
Here's a couple of resources to get you started:
-
Rails的保留 话的。这一次似乎是相当及时更新,最近更新于2010年2月份,甚至超越了铁轨,并列出与SQL一些常见的命名冲突。死
在轨 - 保留字的。这里住着的Heroku应用为特色的保留轨字检索表。在这一个内容似乎是用户管理的,所以任何人都用一个账户可以添加一个新词。
Rails reserved words. This one seems to be fairly up to date, last updated on Feb 2010. It even goes beyond rails and lists some common naming conflicts with SQL.dead- Reserved words in rails. Here lives a heroku application featuring a searchable table of reserved rails words. The content on this one seems to be user-managed, so anybody with an account can add a new word.
这篇关于与ActiveRecord模型保留名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文