routes.rb 913 B

123456789101112131415161718192021222324252627282930
  1. #---
  2. # Excerpted from "Agile Web Development with Rails",
  3. # published by The Pragmatic Bookshelf.
  4. # Copyrights apply to this code. It may not be used to create training material,
  5. # courses, books, articles, and the like. Contact us if you are in doubt.
  6. # We make no guarantees that this code is fit for any purpose.
  7. # Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
  8. #---
  9. require './app/store'
  10. Depot::Application.routes.draw do
  11. match 'store' => StoreApp.new
  12. get 'admin' => 'admin#index'
  13. controller :sessions do
  14. get 'login' => :new
  15. post 'login' => :create
  16. delete 'logout' => :destroy
  17. end
  18. scope '(:locale)' do
  19. resources :users
  20. resources :orders do
  21. resources :line_items
  22. end
  23. resources :line_items
  24. resources :carts
  25. resources :products do
  26. get :who_bought, on: :member
  27. end
  28. root to: 'store#index', as: 'store'
  29. end
  30. end