Froze rails gems
[depot.git] / vendor / rails / railties / lib / rails_generator / generators / components / scaffold / USAGE
1 Description:
2 Scaffolds an entire resource, from model and migration to controller and
3 views, along with a full test suite. The resource is ready to use as a
4 starting point for your RESTful, resource-oriented application.
5
6 Pass the name of the model (in singular form), either CamelCased or
7 under_scored, as the first argument, and an optional list of attribute
8 pairs.
9
10 Attribute pairs are column_name:sql_type arguments specifying the
11 model's attributes. Timestamps are added by default, so you don't have to
12 specify them by hand as 'created_at:datetime updated_at:datetime'.
13
14 You don't have to think up every attribute up front, but it helps to
15 sketch out a few so you can start working with the resource immediately.
16
17 For example, 'scaffold post title:string body:text published:boolean'
18 gives you a model with those three attributes, a controller that handles
19 the create/show/update/destroy, forms to create and edit your posts, and
20 an index that lists them all, as well as a map.resources :posts
21 declaration in config/routes.rb.
22
23 If you want to remove all the generated files, run
24 'script/destroy scaffold ModelName'.
25
26 Examples:
27 `./script/generate scaffold post`
28 `./script/generate scaffold post title:string body:text published:boolean`
29 `./script/generate scaffold purchase order_id:integer amount:decimal`