diff options
author | Ryan Bigg <radarlistener@gmail.com> | 2012-03-14 12:00:54 -0700 |
---|---|---|
committer | Ryan Bigg <radarlistener@gmail.com> | 2012-03-14 12:00:54 -0700 |
commit | 4c1861f427f47d95203e7796bca655bceaf63df0 (patch) | |
tree | df8cac5e164d971f1a3d5e0a42c72795001533f6 /railties/guides/source/getting_started.textile | |
parent | f7a37717448c733aefd37fe633ac56447b180319 (diff) | |
download | rails-4c1861f427f47d95203e7796bca655bceaf63df0.tar.gz rails-4c1861f427f47d95203e7796bca655bceaf63df0.tar.bz2 rails-4c1861f427f47d95203e7796bca655bceaf63df0.zip |
[getting started] Improve prose for initial routing section
Diffstat (limited to 'railties/guides/source/getting_started.textile')
-rw-r--r-- | railties/guides/source/getting_started.textile | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 51969d2eac..baf14b4f5d 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -186,10 +186,11 @@ Now that we have made the controller and view, we need to tell Rails when we wan To fix this, delete the +index.html+ file located inside the +public+ directory of the application. +We need to do this because Rails will serve any static file in the +public+ directory that matches a route in preference to any dynamic content we generate from the controllers. -We need to do this as Rails will deliver any static file in the +public+ directory in preference to any dynamic content we generate from the controllers. +Next, you have to tell Rails where your actual home page is located. -Now, you have to tell Rails where your actual home page is located. Open the file +config/routes.rb+ in your editor. This is your application's _routing file_ which holds entries in a special DSL (domain-specific language) that tells Rails how to connect incoming requests to controllers and actions. This file contains many sample routes on commented lines, and one of them actually shows you how to connect the root of your site to a specific controller and action. Find the line beginning with +root :to+ and uncomment it. It should look something like the following: +Open the file +config/routes.rb+ in your editor. This is your application's _routing file_ which holds entries in a special DSL (domain-specific language) that tells Rails how to connect incoming requests to controllers and actions. This file contains many sample routes on commented lines, and one of them actually shows you how to connect the root of your site to a specific controller and action. Find the line beginning with +root :to+ and uncomment it. It should look something like the following: <ruby> Blog::Application.routes.draw do @@ -200,11 +201,9 @@ Blog::Application.routes.draw do root :to => "home#index" </ruby> -The +root :to => "home#index"+ tells Rails to map the root action to the home -controller's index action. +The +root :to => "home#index"+ tells Rails to map requests to the root of the application to the home controller's index action. This was created earlier when you ran the controller generator (+rails generate controller home index+). -Now if you navigate to "http://localhost:3000":http://localhost:3000 in your -browser, you'll see +Hello, Rails!+. +If you navigate to "http://localhost:3000":http://localhost:3000 in your browser, you'll see +Hello, Rails!+. NOTE. For more information about routing, refer to "Rails Routing from the Outside In":routing.html. |