如何从 Rails 生成器获取有关类型修饰符的文档
How to get documentation from Rails generators about type modifiers
在 Active Record Migrations in Rails 4.2.x, the section 2.3 Passing Modifiers 的文档中说:
Some commonly used type modifiers can be passed directly on the
command line. They are enclosed by curly braces and follow the field
type:
For instance, running:
$ bin/rails generate migration AddDetailsToProducts
'price:decimal{5,2}' supplier:references{polymorphic}
...
Have a look at the generators help output for further details.
然而,运行 bundle exec rails generate migration --help
in Rails 4.2.x(在我的例子中是 4.2.3)没有提到任何关于传递类型修饰符的事情——我可以连一个花括号都看不到。
我可以在 3.5 Column Modifiers 上看到一些文档,但是我如何获得被称为来自 "generators help output" 的文档?
要获取描述类型修饰符的内联帮助,您需要运行
bundle exec rails generate model --help
另外,帮助文本来自这里:https://github.com/randoum/rails/blob/master/railties/lib/rails/generators/rails/model/USAGE
在 Active Record Migrations in Rails 4.2.x, the section 2.3 Passing Modifiers 的文档中说:
Some commonly used type modifiers can be passed directly on the command line. They are enclosed by curly braces and follow the field type:
For instance, running:
$ bin/rails generate migration AddDetailsToProducts 'price:decimal{5,2}' supplier:references{polymorphic}
...
Have a look at the generators help output for further details.
然而,运行 bundle exec rails generate migration --help
in Rails 4.2.x(在我的例子中是 4.2.3)没有提到任何关于传递类型修饰符的事情——我可以连一个花括号都看不到。
我可以在 3.5 Column Modifiers 上看到一些文档,但是我如何获得被称为来自 "generators help output" 的文档?
要获取描述类型修饰符的内联帮助,您需要运行
bundle exec rails generate model --help
另外,帮助文本来自这里:https://github.com/randoum/rails/blob/master/railties/lib/rails/generators/rails/model/USAGE