diff --git a/railties/doc/guides/html/getting_started_with_rails.html b/railties/doc/guides/html/getting_started_with_rails.html index f0b30e6218..dcf112ef6d 100644 --- a/railties/doc/guides/html/getting_started_with_rails.html +++ b/railties/doc/guides/html/getting_started_with_rails.html @@ -572,125 +572,70 @@ http://www.gnu.org/software/src-highlite -->
In any case, Rails will create a folder in your working directory called blog. Open up that folder and explore its contents. Most of the work in this tutorial will happen in the app/ folder, but here’s a basic rundown on the function of each folder that Rails creates in a new application by default:
| - File/Folder - | -- Purpose - | -
|---|---|
| File/Folder | +Purpose | +
| - README - | -- This is a brief instruction manual for your application. Use it to tell others what your application does, how to set it up, and so on. - | -
| - Rakefile - | -- This file contains batch jobs that can be run from the terminal. - | -
| - app/ - | -- Contains the controllers, models, and views for your application. You’ll focus on this folder for the remainder of this guide. - | -
| - config/ - | -- Configure your application’s runtime rules, routes, database, and more. - | -
| - db/ - | -- Shows your current database schema, as well as the database migrations. You’ll learn about migrations shortly. - | -
| - doc/ - | -- In-depth documentation for your application. - | -
| - lib/ - | -- Extended modules for your application (not covered in this guide). - | -
| - log/ - | -- Application log files. - | -
| - public/ - | -- The only folder seen to the world as-is. This is where your images, javascript, stylesheets (CSS), and other static files go. - | -
| - script/ - | -- Scripts provided by Rails to do recurring tasks, such as benchmarking, plugin installation, and starting the console or the web server. - | -
| - test/ - | -- Unit tests, fixtures, and other test apparatus. These are covered in Testing Rails Applications - | -
| - tmp/ - | -- Temporary files - | -
| - vendor/ - | -- A place for third-party code. In a typical Rails application, this includes Ruby Gems, the Rails source code (if you install it into your project) and plugins containing additional prepackaged functionality. - | -
README |
+This is a brief instruction manual for your application. Use it to tell others what your application does, how to set it up, and so on. |
+
Rakefile |
+This file contains batch jobs that can be run from the terminal. |
+
app/ |
+Contains the controllers, models, and views for your application. You’ll focus on this folder for the remainder of this guide. |
+
config/ |
+Configure your application’s runtime rules, routes, database, and more. |
+
db/ |
+Shows your current database schema, as well as the database migrations. You’ll learn about migrations shortly. |
+
doc/ |
+In-depth documentation for your application. |
+
lib/ |
+Extended modules for your application (not covered in this guide). |
+
log/ |
+Application log files. |
+
public/ |
+The only folder seen to the world as-is. This is where your images, javascript, stylesheets (CSS), and other static files go. |
+
script/ |
+Scripts provided by Rails to do recurring tasks, such as benchmarking, plugin installation, and starting the console or the web server. |
+
test/ |
+Unit tests, fixtures, and other test apparatus. These are covered in Testing Rails Applications |
+
tmp/ |
+Temporary files |
+
vendor/ |
+A place for third-party code. In a typical Rails application, this includes Ruby Gems, the Rails source code (if you install it into your project) and plugins containing additional prepackaged functionality. |
+
The scaffold generator will build 13 files in your application, along with some folders, and edit one more. Here’s a quick overview of what it creates:
| - File - | -- Purpose - | -
|---|---|
| File | +Purpose | +
| - app/models/post.rb - | -- The Post model - | -
| - db/migrate/20081013124235_create_posts.rb - | -- Migration to create the posts table in your database (your name will include a different timestamp) - | -
| - app/views/posts/index.html.erb - | -- A view to display an index of all posts - | -
| - app/views/posts/show.html.erb - | -- A view to display a single post - | -
| - app/views/posts/new.html.erb - | -- A view to create a new post - | -
| - app/views/posts/edit.html.erb - | -- A view to edit an existing post - | -
| - app/views/layouts/posts.html.erb - | -- A view to control the overall look and feel of the other posts views - | -
| - public/stylesheets/scaffold.css - | -- Cascading style sheet to make the scaffolded views look better - | -
| - app/controllers/posts_controller.rb - | -- The Posts controller - | -
| - test/functional/posts_controller_test.rb - | -- Functional testing harness for the posts controller - | -
| - app/helpers/posts_helper.rb - | -- Helper functions to be used from the posts views - | -
| - config/routes.rb - | -- Edited to include routing information for posts - | -
| - test/fixtures/posts.yml - | -- Dummy posts for use in testing - | -
| - test/unit/post_test.rb - | -- Unit testing harness for the posts model - | -
app/models/post.rb |
+The Post model |
+
db/migrate/20081013124235_create_posts.rb |
+Migration to create the posts table in your database (your name will include a different timestamp) |
+
app/views/posts/index.html.erb |
+A view to display an index of all posts |
+
app/views/posts/show.html.erb |
+A view to display a single post |
+
app/views/posts/new.html.erb |
+A view to create a new post |
+
app/views/posts/edit.html.erb |
+A view to edit an existing post |
+
app/views/layouts/posts.html.erb |
+A view to control the overall look and feel of the other posts views |
+
public/stylesheets/scaffold.css |
+Cascading style sheet to make the scaffolded views look better |
+
app/controllers/posts_controller.rb |
+The Posts controller |
+
test/functional/posts_controller_test.rb |
+Functional testing harness for the posts controller |
+
app/helpers/posts_helper.rb |
+Helper functions to be used from the posts views |
+
config/routes.rb |
+Edited to include routing information for posts |
+
test/fixtures/posts.yml |
+Dummy posts for use in testing |
+
test/unit/post_test.rb |
+Unit testing harness for the posts model |
+
creates seven different routes in your application:
| - HTTP verb - | -- URL - | -- controller - | -- action - | -- used for - | -
|---|---|---|---|---|
| HTTP verb | +URL | +controller | +action | +used for | +
| - GET - | -- /photos - | -- Photos - | -- index - | -- display a list of all photos - | -
| - GET - | -- /photos/new - | -- Photos - | -- new - | -- return an HTML form for creating a new photo - | -
| - POST - | -- /photos - | -- Photos - | -- create - | -- create a new photo - | -
| - GET - | -- /photos/1 - | -- Photos - | -- show - | -- display a specific photo - | -
| - GET - | -- /photos/1/edit - | -- Photos - | -- edit - | -- return an HTML form for editing a photo - | -
| - PUT - | -- /photos/1 - | -- Photos - | -- update - | -- update a specific photo - | -
| - DELETE - | -- /photos/1 - | -- Photos - | -- destroy - | -- delete a specific photo - | -
GET |
+/photos |
+Photos |
+index |
+display a list of all photos |
+
GET |
+/photos/new |
+Photos |
+new |
+return an HTML form for creating a new photo |
+
POST |
+/photos |
+Photos |
+create |
+create a new photo |
+
GET |
+/photos/1 |
+Photos |
+show |
+display a specific photo |
+
GET |
+/photos/1/edit |
+Photos |
+edit |
+return an HTML form for editing a photo |
+
PUT |
+/photos/1 |
+Photos |
+update |
+update a specific photo |
+
DELETE |
+/photos/1 |
+Photos |
+destroy |
+delete a specific photo |
+
creates six different routes in your application:
| - HTTP verb - | -- URL - | -- controller - | -- action - | -- used for - | -
|---|---|---|---|---|
| HTTP verb | +URL | +controller | +action | +used for | +
| - GET - | -- /geocoder/new - | -- Geocoders - | -- new - | -- return an HTML form for creating the new geocoder - | -
| - POST - | -- /geocoder - | -- Geocoders - | -- create - | -- create the new geocoder - | -
| - GET - | -- /geocoder - | -- Geocoders - | -- show - | -- display the one and only geocoder resource - | -
| - GET - | -- /geocoder/edit - | -- Geocoders - | -- edit - | -- return an HTML form for editing the geocoder - | -
| - PUT - | -- /geocoder - | -- Geocoders - | -- update - | -- update the one and only geocoder resource - | -
| - DELETE - | -- /geocoder - | -- Geocoders - | -- destroy - | -- delete the geocoder resource - | -
GET |
+/geocoder/new |
+Geocoders |
+new |
+return an HTML form for creating the new geocoder |
+
POST |
+/geocoder |
+Geocoders |
+create |
+create the new geocoder |
+
GET |
+/geocoder |
+Geocoders |
+show |
+display the one and only geocoder resource |
+
GET |
+/geocoder/edit |
+Geocoders |
+edit |
+return an HTML form for editing the geocoder |
+
PUT |
+/geocoder |
+Geocoders |
+update |
+update the one and only geocoder resource |
+
DELETE |
+/geocoder |
+Geocoders |
+destroy |
+delete the geocoder resource |
+
will recognize incoming URLs containing photo but route the requests to the Images controller:
| - HTTP verb - | -- URL - | -- controller - | -- action - | -- used for - | -
|---|---|---|---|---|
| HTTP verb | +URL | +controller | +action | +used for | +
| - GET - | -- /photos - | -- Images - | -- index - | -- display a list of all images - | -
| - GET - | -- /photos/new - | -- Images - | -- new - | -- return an HTML form for creating a new image - | -
| - POST - | -- /photos - | -- Images - | -- create - | -- create a new image - | -
| - GET - | -- /photos/1 - | -- Images - | -- show - | -- display a specific image - | -
| - GET - | -- /photos/1/edit - | -- Images - | -- edit - | -- return an HTML form for editing a image - | -
| - PUT - | -- /photos/1 - | -- Images - | -- update - | -- update a specific image - | -
| - DELETE - | -- /photos/1 - | -- Images - | -- destroy - | -- delete a specific image - | -
GET |
+/photos |
+Images |
+index |
+display a list of all images |
+
GET |
+/photos/new |
+Images |
+new |
+return an HTML form for creating a new image |
+
POST |
+/photos |
+Images |
+create |
+create a new image |
+
GET |
+/photos/1 |
+Images |
+show |
+display a specific image |
+
GET |
+/photos/1/edit |
+Images |
+edit |
+return an HTML form for editing a image |
+
PUT |
+/photos/1 |
+Images |
+update |
+update a specific image |
+
DELETE |
+/photos/1 |
+Images |
+destroy |
+delete a specific image |
+
will recognize incoming URLs containing image but route the requests to the Photos controller:
| - HTTP verb - | -- URL - | -- controller - | -- action - | -- used for - | -
|---|---|---|---|---|
| HTTP verb | +URL | +controller | +action | +used for | +
| - GET - | -- /images - | -- Photos - | -- index - | -- display a list of all photos - | -
| - GET - | -- /images/new - | -- Photos - | -- new - | -- return an HTML form for creating a new photo - | -
| - POST - | -- /images - | -- Photos - | -- create - | -- create a new photo - | -
| - GET - | -- /images/1 - | -- Photos - | -- show - | -- display a specific photo - | -
| - GET - | -- /images/1/edit - | -- Photos - | -- edit - | -- return an HTML form for editing a photo - | -
| - PUT - | -- /images/1 - | -- Photos - | -- update - | -- update a specific photo - | -
| - DELETE - | -- /images/1 - | -- Photos - | -- destroy - | -- delete a specific photo - | -
GET |
+/images |
+Photos |
+index |
+display a list of all photos |
+
GET |
+/images/new |
+Photos |
+new |
+return an HTML form for creating a new photo |
+
POST |
+/images |
+Photos |
+create |
+create a new photo |
+
GET |
+/images/1 |
+Photos |
+show |
+display a specific photo |
+
GET |
+/images/1/edit |
+Photos |
+edit |
+return an HTML form for editing a photo |
+
PUT |
+/images/1 |
+Photos |
+update |
+update a specific photo |
+
DELETE |
+/images/1 |
+Photos |
+destroy |
+delete a specific photo |
+
In addition to the routes for magazines, this declaration will also create routes for ads, each of which requires the specification of a magazine in the URL:
| - HTTP verb - | -- URL - | -- controller - | -- action - | -- used for - | -
|---|---|---|---|---|
| HTTP verb | +URL | +controller | +action | +used for | +
| - GET - | -- /magazines/1/ads - | -- Ads - | -- index - | -- display a list of all ads for a specific magazine - | -
| - GET - | -- /magazines/1/ads/new - | -- Ads - | -- new - | -- return an HTML form for creating a new ad belonging to a specific magazine - | -
| - POST - | -- /magazines/1/ads - | -- Ads - | -- create - | -- create a new ad belonging to a specific magazine - | -
| - GET - | -- /magazines/1/ads/1 - | -- Ads - | -- show - | -- display a specific ad belonging to a specific magazine - | -
| - GET - | -- /magazines/1/ads/1/edit - | -- Ads - | -- edit - | -- return an HTML form for editing an ad belonging to a specific magazine - | -
| - PUT - | -- /magazines/1/ads/1 - | -- Ads - | -- update - | -- update a specific ad belonging to a specific magazine - | -
| - DELETE - | -- /magazines/1/ads/1 - | -- Ads - | -- destroy - | -- delete a specific ad belonging to a specific magazine - | -
GET |
+/magazines/1/ads |
+Ads |
+index |
+display a list of all ads for a specific magazine |
+
GET |
+/magazines/1/ads/new |
+Ads |
+new |
+return an HTML form for creating a new ad belonging to a specific magazine |
+
POST |
+/magazines/1/ads |
+Ads |
+create |
+create a new ad belonging to a specific magazine |
+
GET |
+/magazines/1/ads/1 |
+Ads |
+show |
+display a specific ad belonging to a specific magazine |
+
GET |
+/magazines/1/ads/1/edit |
+Ads |
+edit |
+return an HTML form for editing an ad belonging to a specific magazine |
+
PUT |
+/magazines/1/ads/1 |
+Ads |
+update |
+update a specific ad belonging to a specific magazine |
+
DELETE |
+/magazines/1/ads/1 |
+Ads |
+destroy |
+delete a specific ad belonging to a specific magazine |
+