tkawa/resources_id_replace — pull request #1 by d6rkaiz (2013-04-08 08:30:10+00:00)
Title: nested resources

resourcesを以下のようにネストした場合

```
resources :projects, :replace_id_with => 'project_id' do
resources :members
end
```

routesが以下のようになりますが

```
$ rake routes
project_members GET /projects/:project_project_id/members(.:format) members#index
POST /projects/:project_project_id/members(.:format) members#create
new_project_member GET /projects/:project_project_id/members/new(.:format) members#new
edit_project_member GET /projects/:project_project_id/members/:id/edit(.:format) members#edit
project_member GET /projects/:project_project_id/members/:id(.:format) members#show
PUT /projects/:project_project_id/members/:id(.:format) members#update
DELETE /projects/:project_project_id/members/:id(.:format) members#destroy
projects GET /projects(.:format) projects#index
POST /projects(.:format) projects#create
new_project GET /projects/new(.:format) projects#new
edit_project GET /projects/:project_id/edit(.:format) projects#edit
project GET /projects/:project_id(.:format) projects#show
PUT /projects/:project_id(.:format) projects#update
DELETE /projects/:project_id(.:format) projects#destroy
```

id を変更することで重複する可能性は減りますので、以下のように `singular` を付けない形の方がいいのではと思いますが如何でしょう？

```
$ rake routes
project_members GET /projects/:project_id/members(.:format) members#index
POST /projects/:project_id/members(.:format) members#create
new_project_member GET /projects/:project_id/members/new(.:format) members#new
edit_project_member GET /projects/:project_id/members/:id/edit(.:format) members#edit
project_member GET /projects/:project_id/members/:id(.:format) members#show
PUT /projects/:project_id/members/:id(.:format) members#update
DELETE /projects/:project_id/members/:id(.:format) members#destroy
projects GET /projects(.:format) projects#index
POST /projects(.:format) projects#create
new_project GET /projects/new(.:format) projects#new
edit_project GET /projects/:project_id/edit(.:format) projects#edit
project GET /projects/:project_id(.:format) projects#show
PUT /projects/:project_id(.:format) projects#update
DELETE /projects/:project_id(.:format) projects#destroy
```

もし賛同して頂けるようであれば取り込んでもらえると嬉しいです。