ruby-on-rails – Rails:属性的命名约定

我用线创建一个模型
rails g scaffold contact firstname:string lastname:string email:string

但是属性应该是这样的

first_name:string

代替?

解决方法

公约不是一成不变的,但遵循它们是很好的.

是的,广泛传播的属性名称约定是snake case.

Snake case:

punctuation is removed and spaces are replaced by single underscores. Normally the letters share the same case (either UPPER_CASE_EMBEDDED_UNDERSCORE or lower_case_embedded_underscore) but the case can be mixed.

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...