diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-10-08 23:32:07 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-10-08 23:32:07 +0000 |
commit | c447d443dd1507c3485de30159adeaeacdc8254d (patch) | |
tree | 845933bff40504de17484815de42d2b5c73e946c /railties/lib/rails_generator/generators/components/scaffold_resource | |
parent | 7ea86773a915ef8bebf1e23c3eed3a8b374d21b3 (diff) | |
download | rails-c447d443dd1507c3485de30159adeaeacdc8254d.tar.gz rails-c447d443dd1507c3485de30159adeaeacdc8254d.tar.bz2 rails-c447d443dd1507c3485de30159adeaeacdc8254d.zip |
Added proper USAGE to the scaffold_resource generator [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5234 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/rails_generator/generators/components/scaffold_resource')
-rw-r--r-- | railties/lib/rails_generator/generators/components/scaffold_resource/USAGE | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/railties/lib/rails_generator/generators/components/scaffold_resource/USAGE b/railties/lib/rails_generator/generators/components/scaffold_resource/USAGE index d72db2103e..c5046d7d63 100644 --- a/railties/lib/rails_generator/generators/components/scaffold_resource/USAGE +++ b/railties/lib/rails_generator/generators/components/scaffold_resource/USAGE @@ -1,8 +1,23 @@ Description: - Explain the generator + The scaffold resource generator creates a model, a controller, and a set of templates for use in a REST-like, + resource-oriented fashion. This basically means that it follows a set of conventions to exploit the full set of + HTTP verbs (GET/POST/PUT/DELETE) and is prepared for multi-client access (like one view for HTML, one for an XML + API, one for ATOM, etc). Everything comes with sample unit and functional tests as well. + + The generator takes the name of the model as its first argument. This model name is then pluralized to get the + controller name. So "scaffold_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 to give you a set of templates for the + view. For example, "scaffold_resource post title:string created_on:date body:text published:boolean" will give + you a model with those four attributes, forms to create and edit those models from, and an index that'll list them + all. + + 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. Example: - ./script/generate scaffold_resource Thing - - This will create: - what/will/it/create + ./script/generate scaffold_resource post # no attributes, view will be anemic + ./script/generate scaffold_resource post title:string created_on:date body:text published:boolean + ./script/generate scaffold_resource purchase order_id:integer created_at:datetime amount:decimal
\ No newline at end of file |