CakePHPと同様、RoRもCRUD(Create, Read, Update, Delete)なディレクトリ構成でアクセスする。
RESTfulとはなんぞやについてはこちらを参照。もしくは資料のP.12〜13辺りに詳しい。
RoRの場合はrakeコマンドを使用することでアプリケーションのメソッドに対するHTTPメソッドの対応リストを見ることができる。
RedRailsの場合、
- ウィンドウ>ビューの表示>Rakeタスク を選択し、「Rake タスク」をビュー画面に表示する
- タスクに「routes」を指定して右端の緑三角ボタンをクリック
でコンソールにリスト表示される。
>rake routes categories GET /categories(.:format) {:controller=>"categories", :action=>"index"} POST /categories(.:format) {:controller=>"categories", :action=>"create"} new_category GET /categories/new(.:format) {:controller=>"categories", :action=>"new"} edit_category GET /categories/:id/edit(.:format) {:controller=>"categories", :action=>"edit"} category GET /categories/:id(.:format) {:controller=>"categories", :action=>"show"} PUT /categories/:id(.:format) {:controller=>"categories", :action=>"update"} DELETE /categories/:id(.:format) {:controller=>"categories", :action=>"destroy"} /:controller/:action/:id /:controller/:action/:id(.:format)
うっほ超便利。