Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. module V2
  2. class Cars < Grape::API
  3. resource :cars do
  4. get do
  5. cars = Car.all
  6. present cars, with: V2::Entities::Car
  7. end
  8. end
  9. end
  10. end
  11.  
  12. module V2
  13. class Cars < Grape::API
  14. resource :trucks do # Renamed from cars to trucks
  15. get do
  16. cars = Car.all
  17. present cars, with: V2::Entities::Car
  18. end
  19. end
  20. end
  21. end
  22.  
  23. Rails.application.routes.draw do
  24.  
  25. namespace :inventory do
  26. resources :assets do
  27. collection do
  28. get :scan
  29. end
  30. end
  31. end
  32.  
  33. resources :vehicles do
  34. resources :cars, except: [:index, :show, :edit]
  35. end
  36.  
  37. get 'home/index'
  38. get 'home/inventory'
  39. get 'home/vehicles'
  40.  
  41. devise_for :users
  42. root to: 'home#index'
  43. mount V2::Base => '/api'
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement