gpt4 book ai didi

ruby-on-rails - rails : Naming conventions for attributes

转载 作者:行者123 更新时间:2023-12-04 07:27:10 25 4
gpt4 key购买 nike

我用这条线创建了一个模型

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.

关于ruby-on-rails - rails : Naming conventions for attributes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8923814/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com