diff options
Diffstat (limited to 'railties/lib/rails_generator/generators/components/resource/templates/USAGE')
-rw-r--r-- | railties/lib/rails_generator/generators/components/resource/templates/USAGE | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/railties/lib/rails_generator/generators/components/resource/templates/USAGE b/railties/lib/rails_generator/generators/components/resource/templates/USAGE new file mode 100644 index 0000000000..39ad0db472 --- /dev/null +++ b/railties/lib/rails_generator/generators/components/resource/templates/USAGE @@ -0,0 +1,18 @@ +Description: + The resource generator creates an empty model and controller for use in a REST-friendly, resource-oriented + application. Say you want to a resource called post. Normally, you could just call "script/generate model post" and + "script/generate controller posts". This generator basically just collapses these two generators into one step. + + The generator takes the name of the model as its first argument. This model name is then pluralized to get the + controller name. So "resource post" will generate a Post model and a PostsController and will be intended + for URLs like /posts and /posts/45. + + As additional parameters, the generator will take attribute pairs described by name and type. These attributes will + be used to prepopulate the migration to create the table for the model and give you a set of predefined fixture. + You don't have to think up all attributes up front, but it's a good idea of adding just the baseline of what's + needed to start really working with the resource. + +Examples: + ./script/generate resource post + ./script/generate resource post title:string created_on:date body:text published:boolean + ./script/generate resource purchase order_id:integer created_at:datetime amount:decimal
\ No newline at end of file |