
Untitled
By: a guest on
Apr 23rd, 2012 | syntax:
None | size: 0.80 KB | hits: 11 | expires: Never
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_')