Froze rails gems
[depot.git] / vendor / rails / railties / lib / rails_generator / generators / components / resource / USAGE
1 Description:
2 Stubs out a new resource including an empty model and controller suitable
3 for a restful, resource-oriented application. Pass the singular model name,
4 either CamelCased or under_scored, as the first argument, and an optional
5 list of attribute pairs.
6
7 Attribute pairs are column_name:sql_type arguments specifying the
8 model's attributes. Timestamps are added by default, so you don't have to
9 specify them by hand as 'created_at:datetime updated_at:datetime'.
10
11 You don't have to think up every attribute up front, but it helps to
12 sketch out a few so you can start working with the resource immediately.
13
14 This creates a model, controller, tests and fixtures for both, and the
15 corresponding map.resources declaration in config/routes.rb
16
17 Unlike the scaffold generator, the resource generator does not create
18 views or add any methods to the generated controller.
19
20 Examples:
21 `./script/generate resource post` # no attributes
22 `./script/generate resource post title:string body:text published:boolean`
23 `./script/generate resource purchase order_id:integer amount:decimal`