Guest User

Untitled

a guest
Apr 23rd, 2012
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. Rails: prefixing the path of scoped routes
  2. scope(:module => 'api', constraints: {subdomain: 'api'}, defaults: {format: 'json'}) do
  3. scope('1', module: 'v1') do
  4. resources :posts
  5. end
  6. end
  7.  
  8. posts GET /1/posts(.:format) api/v1/posts#index {:format=>"json"}
  9. POST /1/posts(.:format) api/v1/posts#create {:format=>"json"}
  10. new_post GET /1/posts/new(.:format) api/v1/posts#new {:format=>"json"}
  11. edit_post GET /1/posts/:id/edit(.:format) api/v1/posts#edit {:format=>"json"}
  12. post GET /1/posts/:id(.:format) api/v1/posts#show {:format=>"json"}
  13. PUT /1/posts/:id(.:format) api/v1/posts#update {:format=>"json"}
  14. DELETE /1/posts/:id(.:format) api/v1/posts#destroy {:format=>"json"}
  15.  
  16. scope('1', module: 'v1', name_prefix: 'v1_')
Advertisement
Add Comment
Please, Sign In to add comment