When you need to add one or more actions to a RESTful resource (do you really need it?) ), using the member and collection routing.
 
 
  
  
  # get
  ' subscriptions/:id/unsubscribe '
  resources:subscriptions
  # good
  resources:subscriptions do Get
   ' unsubscribe ', on:: member
  end
  # photos/search ' to ' resources
  :p hotos
  # good
  Resources:p Hotos does get
   ' search ', On:: Collection
  End
 
   
  
If you need to define multiple member/collection routes, use the alternate chunk syntax (block syntax).
 
 
 
  
  
 Resources:subscriptions do
   -get
    ' unsubscribe '
    # More routing end
  -Resources
  : Photos do
   collection does get
    ' search '
    # more route
   End
  
 
   
  
Use nested routines to better express the relationship with the ActiveRecord model by (nested routes).
 
 
 
  
  
 Class Post < activerecord::base
   has_many:comments
  End
  class Comments < ActiveRecord::Base
   Belongs_to:p ost
  # routes.rb Resources
  :p OSTs does
   resources:comments
  end
 
   
  
Use namespace routing to group related behavior.
 
 
  
  
  Namespace:admin do
   # directs/admin/products/* to admin::P roductscontroller
   # (app/controllers/admin/ PRODUCTS_CONTROLLER.RB)
   :p roducts End
  
 
   
  
Do not use the crazy route left behind in the controller (Legacy Wild Controller route). This route allows the actions of each controller to be accessed through a GET request.
 
 
  
  
  # very poor
  match ': Controller (/:action (/:id (.: format))) '