タイトルの通りなんだけど、例えばroutes.rbに以下のようにpeopleと記述して、ルートを確認すると・・・。
map.resources :people # routes.rbに記述
$ rake routes
people GET /people {:action=>"index", :controller=>"people"} formatted_people GET /people.:format {:action=>"index", :controller=>"people"} POST /people {:action=>"create", :controller=>"people"} POST /people.:format {:action=>"create", :controller=>"people"} new_person GET /people/new {:action=>"new", :controller=>"people"} formatted_new_person GET /people/new.:format {:action=>"new", :controller=>"people"} edit_person GET /people/:id/edit {:action=>"edit", :controller=>"people"} formatted_edit_person GET /people/:id/edit.:format {:action=>"edit", :controller=>"people"} person GET /people/:id {:action=>"show", :controller=>"people"} formatted_person GET /people/:id.:format {:action=>"show", :controller=>"people"} PUT /people/:id {:action=>"update", :controller=>"people"} PUT /people/:id.:format {:action=>"update", :controller=>"people"} DELETE /people/:id {:action=>"destroy", :controller=>"people"} DELETE /people/:id.:format {:action=>"destroy", :controller=>"people"} /:controller/:action/:id /:controller/:action/:id.:format
というように、peopleの単数形であるpersonに変換してくれている。当然、menだとmanにしてくれる!実践 Railsを読んでて気付いたんだけど、これは便利だなぁ。booksがリソースの時にbookに変換したとか、単純にsを取ってくれるだけならなんとも思わなかったけど。
追記
つか、これって2.x以前からあった機能だったのか・・・。Inflectorクラスがやっている模様。
実践 Rails -強力なWebアプリケーションをすばやく構築するテクニック
posted with amazlet at 08.12.10