在Geddy的脚手架中,数据类型"默认"之间有什么区别?而不是数据类型?

时间:2014-03-19 21:57:36

标签: geddy

例如:

geddy gen scaffold person name:default

geddy gen scaffold person name

都使用数据类型“string”创建属性“name”。这两种语法之间有什么区别吗?

1 个答案:

答案 0 :(得分:0)

来自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