annotate config/routes.rb @ 7:3a1f6c2e195d

Added raw paste view.
author Edho Arief <edho@myconan.net>
date Sun, 26 Aug 2012 11:39:07 -0700
parents 23178d3de796
children 418105d973f1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
1 Zeropaste::Application.routes.draw do
4
23178d3de796 Slim controller (this app barely has any function)
Edho Arief <edho@myconan.net>
parents: 2
diff changeset
2 resources :pastes, :only => [:show, :new, :create]
23178d3de796 Slim controller (this app barely has any function)
Edho Arief <edho@myconan.net>
parents: 2
diff changeset
3 get '/:id' => 'pastes#show', :constraints => { :id => /\d+/ }
23178d3de796 Slim controller (this app barely has any function)
Edho Arief <edho@myconan.net>
parents: 2
diff changeset
4 root :to => 'pastes#new'
2
42de15334db1 Added the pastes.
Edho Arief <edho@myconan.net>
parents: 0
diff changeset
5
0
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
6 # The priority is based upon order of creation:
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
7 # first created -> highest priority.
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
8
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
9 # Sample of regular route:
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
10 # match 'products/:id' => 'catalog#view'
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
11 # Keep in mind you can assign values other than :controller and :action
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
12
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
13 # Sample of named route:
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
14 # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
15 # This route can be invoked with purchase_url(:id => product.id)
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
16
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
17 # Sample resource route (maps HTTP verbs to controller actions automatically):
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
18 # resources :products
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
19
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
20 # Sample resource route with options:
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
21 # resources :products do
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
22 # member do
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
23 # get 'short'
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
24 # post 'toggle'
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
25 # end
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
26 #
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
27 # collection do
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
28 # get 'sold'
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
29 # end
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
30 # end
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
31
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
32 # Sample resource route with sub-resources:
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
33 # resources :products do
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
34 # resources :comments, :sales
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
35 # resource :seller
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
36 # end
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
37
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
38 # Sample resource route with more complex sub-resources
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
39 # resources :products do
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
40 # resources :comments
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
41 # resources :sales do
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
42 # get 'recent', :on => :collection
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
43 # end
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
44 # end
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
45
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
46 # Sample resource route within a namespace:
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
47 # namespace :admin do
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
48 # # Directs /admin/products/* to Admin::ProductsController
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
49 # # (app/controllers/admin/products_controller.rb)
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
50 # resources :products
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
51 # end
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
52
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
53 # You can have the root of your site routed with "root"
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
54 # just remember to delete public/index.html.
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
55 # root :to => 'welcome#index'
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
56
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
57 # See how all your routes lay out with "rake routes"
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
58
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
59 # This is a legacy wild controller route that's not recommended for RESTful applications.
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
60 # Note: This route will make all actions in every controller accessible via GET requests.
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
61 # match ':controller(/:action(/:id))(.:format)'
4aa8194a1733 Initial.
Edho Arief <edho@myconan.net>
parents:
diff changeset
62 end