daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. hello-21:58:43:~/programmation/ruby/rails/pictrails/trunk$ rake routes
  2. (in /home/shingara/programmation/ruby/rails/pictrails/trunk)
  3.                      galleries GET    /galleries                                       {:controller=>"galleries", :action=>"index"}
  4.            formatted_galleries GET    /galleries.:format                               {:controller=>"galleries", :action=>"index"}
  5.                                POST   /galleries                                       {:controller=>"galleries", :action=>"create"}
  6.                                POST   /galleries.:format                               {:controller=>"galleries", :action=>"create"}
  7.                    new_gallery GET    /galleries/new                                   {:controller=>"galleries", :action=>"new"}
  8.          formatted_new_gallery GET    /galleries/new.:format                           {:controller=>"galleries", :action=>"new"}
  9.                   edit_gallery GET    /galleries/:id/edit                              {:controller=>"galleries", :action=>"edit"}
  10.         formatted_edit_gallery GET    /galleries/:id/edit.:format                      {:controller=>"galleries", :action=>"edit"}
  11.                        gallery GET    /galleries/:id                                   {:controller=>"galleries", :action=>"show"}
  12.              formatted_gallery GET    /galleries/:id.:format                           {:controller=>"galleries", :action=>"show"}
  13.                                PUT    /galleries/:id                                   {:controller=>"galleries", :action=>"update"}
  14.                                PUT    /galleries/:id.:format                           {:controller=>"galleries", :action=>"update"}
  15.                                DELETE /galleries/:id                                   {:controller=>"galleries", :action=>"destroy"}
  16.                                DELETE /galleries/:id.:format                           {:controller=>"galleries", :action=>"destroy"}
  17.               gallery_pictures GET    /galleries/:gallery_id/pictures                  {:controller=>"pictures", :action=>"index"}
  18.     formatted_gallery_pictures GET    /galleries/:gallery_id/pictures.:format          {:controller=>"pictures", :action=>"index"}
  19.                                POST   /galleries/:gallery_id/pictures                  {:controller=>"pictures", :action=>"create"}
  20.                                POST   /galleries/:gallery_id/pictures.:format          {:controller=>"pictures", :action=>"create"}
  21.            new_gallery_picture GET    /galleries/:gallery_id/pictures/new              {:controller=>"pictures", :action=>"new"}
  22.  formatted_new_gallery_picture GET    /galleries/:gallery_id/pictures/new.:format      {:controller=>"pictures", :action=>"new"}
  23.           edit_gallery_picture GET    /galleries/:gallery_id/pictures/:id/edit         {:controller=>"pictures", :action=>"edit"}
  24. formatted_edit_gallery_picture GET    /galleries/:gallery_id/pictures/:id/edit.:format {:controller=>"pictures", :action=>"edit"}
  25.                gallery_picture GET    /galleries/:gallery_id/pictures/:id              {:controller=>"pictures", :action=>"show"}
  26.      formatted_gallery_picture GET    /galleries/:gallery_id/pictures/:id.:format      {:controller=>"pictures", :action=>"show"}
  27.                                PUT    /galleries/:gallery_id/pictures/:id              {:controller=>"pictures", :action=>"update"}
  28.                                PUT    /galleries/:gallery_id/pictures/:id.:format      {:controller=>"pictures", :action=>"update"}
  29.                                DELETE /galleries/:gallery_id/pictures/:id              {:controller=>"pictures", :action=>"destroy"}
  30.                                DELETE /galleries/:gallery_id/pictures/:id.:format      {:controller=>"pictures", :action=>"destroy"}
  31.                           root        /                                                {:action=>"index", :controller=>"galleries"}
  32.  
  33.  
  34.  
  35.  
  36. #/config/route
  37. ActionController::Routing::Routes.draw do |map|
  38.  
  39.   map.resources :galleries do |gallerie|
  40.     gallerie.resources :pictures
  41.   end
  42.   map.root :controller => 'galleries'
  43.  
  44. end
  45.  
  46.  
  47. #Appel pour avoir l'url : /gallery/1/pictures/2 ????
  48.  
  49. @picture = Picture.find 2
  50.  
  51. #Route nommé :
  52. gallery_picture(@picture) => /gallery/2/pictures
RAW Paste Data
Top