Skip to content

Instantly share code, notes, and snippets.

@spockz
Created July 2, 2010 13:41
Show Gist options
  • Select an option

  • Save spockz/461371 to your computer and use it in GitHub Desktop.

Select an option

Save spockz/461371 to your computer and use it in GitHub Desktop.
user_sessions GET /user_sessions(.:format) {:controller=>"user_sessions", :action=>"index"}
POST /user_sessions(.:format) {:controller=>"user_sessions", :action=>"create"}
new_user_session GET /user_sessions/new(.:format) {:controller=>"user_sessions", :action=>"new"}
edit_user_session GET /user_sessions/:id/edit(.:format) {:controller=>"user_sessions", :action=>"edit"}
user_session GET /user_sessions/:id(.:format) {:controller=>"user_sessions", :action=>"show"}
PUT /user_sessions/:id(.:format) {:controller=>"user_sessions", :action=>"update"}
DELETE /user_sessions/:id(.:format) {:controller=>"user_sessions", :action=>"destroy"}
payment_methods GET /payment_methods(.:format) {:controller=>"payment_methods", :action=>"index"}
POST /payment_methods(.:format) {:controller=>"payment_methods", :action=>"create"}
new_payment_method GET /payment_methods/new(.:format) {:controller=>"payment_methods", :action=>"new"}
edit_payment_method GET /payment_methods/:id/edit(.:format) {:controller=>"payment_methods", :action=>"edit"}
payment_method GET /payment_methods/:id(.:format) {:controller=>"payment_methods", :action=>"show"}
PUT /payment_methods/:id(.:format) {:controller=>"payment_methods", :action=>"update"}
DELETE /payment_methods/:id(.:format) {:controller=>"payment_methods", :action=>"destroy"}
users GET /users(.:format) {:controller=>"users", :action=>"index"}
POST /users(.:format) {:controller=>"users", :action=>"create"}
new_user GET /users/new(.:format) {:controller=>"users", :action=>"new"}
edit_user GET /users/:id/edit(.:format) {:controller=>"users", :action=>"edit"}
user GET /users/:id(.:format) {:controller=>"users", :action=>"show"}
PUT /users/:id(.:format) {:controller=>"users", :action=>"update"}
DELETE /users/:id(.:format) {:controller=>"users", :action=>"destroy"}
invoice_shop GET /shop/invoice(.:format) {:controller=>"shop", :action=>"invoice"}
shop_index GET /shop(.:format) {:controller=>"shop", :action=>"index"}
POST /shop(.:format) {:controller=>"shop", :action=>"create"}
new_shop GET /shop/new(.:format) {:controller=>"shop", :action=>"new"}
edit_shop GET /shop/:id/edit(.:format) {:controller=>"shop", :action=>"edit"}
shop GET /shop/:id(.:format) {:controller=>"shop", :action=>"show"}
PUT /shop/:id(.:format) {:controller=>"shop", :action=>"update"}
DELETE /shop/:id(.:format) {:controller=>"shop", :action=>"destroy"}
root / {:action=>"index", :controller=>"pages"}
/shop/download/:filename {:controller=>"shop", :action=>"download"}
/shop/buy {:controller=>"shop", :action=>"buy_post", :method=>:post}
login /login {:controller=>"user_sessions", :action=>"new"}
logout /logout {:controller=>"user_sessions", :action=>"destroy"}
home /home {:action=>"index", :controller=>"pages"}
products /products {:controller=>"pages", :action=>"products"}
tac /tac {:controller=>"pages", :action=>"tac"}
/:controller/:action/:id
/:controller/:action/:id(.:format)
----
ActionController::Routing::Routes.draw do |map|
map.resources :user_sessions
map.resources :payment_methods
map.resources :users
map.resources :shop, :collection => {:invoice => :get}
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# map.resources :products
# Sample resource route with options:
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
# Sample resource route with sub-resources:
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
# Sample resource route with more complex sub-resources
# map.resources :products do |products|
# products.resources :comments
# products.resources :sales, :collection => { :recent => :get }
# end
# Sample resource route within a namespace:
# map.namespace :admin do |admin|
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
# admin.resources :products
# end
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
map.root :controller => "pages"
# See how all your routes lay out with "rake routes"
# Install the default routes as the lowest priority.
# Note: These default routes make all actions in every controller accessible via GET requests. You should
# consider removing or commenting them out if you're using named routes and resources.
map.connect "shop/download/:filename", :controller => "shop", :action => "download", :filename => /.*/
map.connect "shop/buy", :controller => "shop", :action => "buy_post", :method => :post
# map.connect "shop/invoice/:"
map.login "login", :controller => "user_sessions", :action => "new"
map.logout "logout", :controller => "user_sessions", :action => "destroy"
map.home "home", :controller => "pages"
map.products "products", :controller => "pages", :action => "products"
map.tac "tac", :controller => "pages", :action => "tac"
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment