Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Rails: prefixing the path of scoped routes
- scope(:module => 'api', constraints: {subdomain: 'api'}, defaults: {format: 'json'}) do
- scope('1', module: 'v1') do
- resources :posts
- end
- end
- posts GET /1/posts(.:format) api/v1/posts#index {:format=>"json"}
- POST /1/posts(.:format) api/v1/posts#create {:format=>"json"}
- new_post GET /1/posts/new(.:format) api/v1/posts#new {:format=>"json"}
- edit_post GET /1/posts/:id/edit(.:format) api/v1/posts#edit {:format=>"json"}
- post GET /1/posts/:id(.:format) api/v1/posts#show {:format=>"json"}
- PUT /1/posts/:id(.:format) api/v1/posts#update {:format=>"json"}
- DELETE /1/posts/:id(.:format) api/v1/posts#destroy {:format=>"json"}
- scope('1', module: 'v1', name_prefix: 'v1_')
Advertisement
Add Comment
Please, Sign In to add comment