moi j’ai Ã§a, c’est plutÃ´t clair je trouve
./script/generate scaffold --help
Usage: ./script/generate scaffold ModelName [field:type, field:type]
–skip-timestamps Don’t add timestamps to the
migration file for this model
–skip-migration Don’t generate a migration file
for this model
-v, --version Show the Rails version number
-h, --help Show this help message and quit.
-p, --pretend Run but do not make any changes.
-f, --force Overwrite files that already
-s, --skip Skip files that already exist.
-q, --quiet Suppress normal output.
-t, --backtrace Debugging: show backtrace on
-c, --svn Modify files with subversion.
(Note: svn must be in path)
Scaffolds an entire resource, from model and migration to
views, along with a full test suite. The resource is ready to use
starting point for your restful, resource-oriented application.
Pass the name of the model, either CamelCased or under_scored, as
argument, and an optional list of attribute pairs.
Attribute pairs are column_name:sql_type arguments specifying the
model's attributes. Timestamps are added by default, so you don't
specify them by hand as ‘created_at:datetime updated_at:datetime’.
You don't have to think up every attribute up front, but it helps
sketch out a few so you can start working with the resource
For example, `scaffold post title:string body:text
gives you a model with those three attributes, a controller that
the create/show/update/destroy, forms to create and edit your
an index that lists them all, as well as a map.resources :posts
declaration in config/routes.rb.
./script/generate scaffold post # no attributes, view will be
./script/generate scaffold post title:string body:text published:boolean
./script/generate scaffold purchase order_id:integer amount:decimal