例如:
geddy gen scaffold person name:default
和
geddy gen scaffold person name
两者都使用数据类型“字符串”创建属性“名称”。这两种语法有什么区别吗?
例如:
geddy gen scaffold person name:default
和
geddy gen scaffold person name
两者都使用数据类型“字符串”创建属性“名称”。这两种语法有什么区别吗?
来自Geddy文档:
$ geddy gen scaffold user name:default
This example creates scaffolding but includes name as the default property that will be used when displaying the content in the views.
In this example the property name is given the type string because no type was given. You could have also written name:string:default (or some other type in place of 'string'). If no default property is given Geddy will use id as the default display property.
当您提供没有类型的属性时,Geddy将假定其类型为string
.
default
另一方面告诉Geddy使用该属性而不是id
属性作为默认显示属性。
例如:如果您执行$ geddy gen scaffold user name:default
Geddy会将属性生name
成为字符串,并且在index.html
您创建之后user
,将显示在列表中的属性将name
是id
.