Skip to content
This repository
Browse code

fixed typos and rephrased few sentences in routing

  • Loading branch information...
commit 51202a1aea80cbe12313bb925b204d54f01fb502 1 parent 6276334
Vijay Dev authored December 10, 2010 fxn committed December 11, 2010

Showing 1 changed file with 11 additions and 11 deletions. Show diff stats Hide diff stats

  1. 22  railties/guides/source/routing.textile
22  railties/guides/source/routing.textile
Source Rendered
@@ -3,7 +3,7 @@ h2. Rails Routing from the Outside In
3 3
 This guide covers the user-facing features of Rails routing. By referring to this guide, you will be able to:
4 4
 
5 5
 * Understand the code in +routes.rb+
6  
-* Construct your own routes, using either the preferred resourceful style or with the <tt>match</tt> method
  6
+* Construct your own routes, using either the preferred resourceful style or the <tt>match</tt> method
7 7
 * Identify what parameters to expect an action to receive
8 8
 * Automatically create paths and URLs using route helpers
9 9
 * Use advanced techniques such as constraints and Rack endpoints
@@ -50,7 +50,7 @@ Resource routing allows you to quickly declare all of the common routes for a gi
50 50
 
51 51
 h4. Resources on the Web
52 52
 
53  
-Browsers request pages from Rails by making a request for a URL using a specific HTTP method, such as +GET+, +POST+, +PUT+ and +DELETE+. Each method is a request to perform an operation on the resource. A resource route maps a number of related request to the actions in a single controller.
  53
+Browsers request pages from Rails by making a request for a URL using a specific HTTP method, such as +GET+, +POST+, +PUT+ and +DELETE+. Each method is a request to perform an operation on the resource. A resource route maps a number of related requests to actions in a single controller.
54 54
 
55 55
 When your Rails application receives an incoming request for
56 56
 
@@ -470,7 +470,7 @@ This route would match paths such as +/photos/A12345+. You can more succinctly e
470 470
 match 'photos/:id' => 'photos#show', :id => /[A-Z]\d{5}/
471 471
 </ruby>
472 472
 
473  
-+:constraints+ takes regular expression. However note that regexp anchors can't be used within constraints. For example following route will not work:
  473
++:constraints+ takes regular expressions with the restriction that regexp anchors can't be used. For example, the following route will not work:
474 474
 
475 475
 <ruby>
476 476
 match '/:id' => 'posts#show', :constraints => {:id => /^\d/}
@@ -536,7 +536,7 @@ match 'photos/*other' => 'photos#unknown'
536 536
 
537 537
 This route would match +photos/12+ or +/photos/long/path/to/12+, setting +params[:other]+ to +"12"+ or +"long/path/to/12"+.
538 538
 
539  
-Wildcard segments do not need to be last in a route. For example
  539
+Wildcard segments can occur anywhere in a route. For example,
540 540
 
541 541
 <ruby>
542 542
 match 'books/*section/:title' => 'books#show'
@@ -544,7 +544,7 @@ match 'books/*section/:title' => 'books#show'
544 544
 
545 545
 would match +books/some/section/last-words-a-memoir+ with +params[:section]+ equals +"some/section"+, and +params[:title]+ equals +"last-words-a-memoir"+.
546 546
 
547  
-Techincally a route can have even more than one wildard segment indeed, the matcher assigns segments to parameters in an intuitive way. For instance
  547
+Technically a route can have even more than one wildcard segment. The matcher assigns segments to parameters in an intuitive way. For example,
548 548
 
549 549
 <ruby>
550 550
 match '*a/foo/*b' => 'test#index'
@@ -641,7 +641,7 @@ constraints(:id => /[A-Z][A-Z][0-9]+/) do
641 641
 end
642 642
 </ruby>
643 643
 
644  
-NOTE: Of course, you can use the more advanced constraints available in non-resourceful routes in this context
  644
+NOTE: Of course, you can use the more advanced constraints available in non-resourceful routes in this context.
645 645
 
646 646
 h4. Overriding the Named Helpers
647 647
 
@@ -651,7 +651,7 @@ The +:as+ option lets you override the normal naming for the named route helpers
651 651
 resources :photos, :as => "images"
652 652
 </ruby>
653 653
 
654  
-will recognize incoming paths beginning with +/photos+ and route the requests to +PhotosController+:
  654
+will recognize incoming paths beginning with +/photos+ and route the requests to +PhotosController+, but use the value of the :as option to name the helpers.
655 655
 
656 656
 |_.HTTP verb|_.Path          |_.action |_.named helper   |
657 657
 |GET        |/photos         |index    | images_path     |
@@ -679,7 +679,7 @@ This would cause the routing to recognize paths such as
679 679
 
680 680
 NOTE: The actual action names aren't changed by this option. The two paths shown would still route to the +new+ and +edit+ actions.
681 681
 
682  
-TIP: If you find yourself wanting to change this option uniformly for all of your routes, you can use a scope:
  682
+TIP: If you find yourself wanting to change this option uniformly for all of your routes, you can use a scope.
683 683
 
684 684
 <ruby>
685 685
 scope :path_names => { :new => "make" } do
@@ -715,7 +715,7 @@ NOTE: The +namespace+ scope will automatically add +:as+ as well as +:module+ an
715 715
 
716 716
 h4. Restricting the Routes Created
717 717
 
718  
-By default, Rails creates routes for all seven of the default actions (index, show, new, create, edit, update, and destroy) for every RESTful route in your application. You can use the +:only+ and +:except+ options to fine-tune this behavior. The +:only+ option tells Rails to create only the specified routes:
  718
+By default, Rails creates routes for the seven default actions (index, show, new, create, edit, update, and destroy) for every RESTful route in your application. You can use the +:only+ and +:except+ options to fine-tune this behavior. The +:only+ option tells Rails to create only the specified routes:
719 719
 
720 720
 <ruby>
721 721
 resources :photos, :only => [:index, :show]
@@ -816,7 +816,7 @@ Routes should be included in your testing strategy (just like the rest of your a
816 816
 
817 817
 h5. The +assert_generates+ Assertion
818 818
 
819  
-Use +assert_generates+ to assert that a particular set of options generate a particular path. You can use this with default routes or custom routes
  819
++assert_generates+ asserts that a particular set of options generate a particular path and can be used with default routes or custom routes.
820 820
 
821 821
 <ruby>
822 822
 assert_generates "/photos/1", { :controller => "photos", :action => "show", :id => "1" }
@@ -825,7 +825,7 @@ assert_generates "/about", :controller => "pages", :action => "about"
825 825
 
826 826
 h5. The +assert_recognizes+ Assertion
827 827
 
828  
-The +assert_recognizes+ assertion is the inverse of +assert_generates+. It asserts that Rails recognizes the given path and routes it to a particular spot in your application.
  828
++assert_recognizes+ is the inverse of +assert_generates+. It asserts that a given path is recognized and routes it to a particular spot in your application.
829 829
 
830 830
 <ruby>
831 831
 assert_recognizes({ :controller => "photos", :action => "show", :id => "1" }, "/photos/1")

0 notes on commit 51202a1

Please sign in to comment.
Something went wrong with that request. Please try again.