30. RubyConf
nice mappings!
URL route name method action
GET tags
/books/:id/tags book_tags
POST create_tag
GET tag
/books/:id/tags/:tag_id book_tag PUT update_tag
DELETE destroy_tag
/books/:id/tags/new new_book_tag GET new_tag
/books/:id/tags/:tag_id/edit edit_book_tag DELETE edit_tag
株式会社 万葉
2009年11月28日土曜日
38. RubyConf
to delete all books
books
DELETE /books
destroy_all_books
DELETE /books/destroy_all
BooksController#destroy_all
株式会社万葉
2009年11月28日土曜日
39. RubyConf
with sub_resources
it s easy!
URL method action
/books/edit GET edit_all
/books PUT update_all
/books DELETE destroy_all
株式会社万葉
2009年11月28日土曜日
40. RubyConf
how to use
map.resources :books,
:collection => {
:edit_all => :get,
:update_all => :put,
:destroy_all => :delete
}
株式会社万葉
2009年11月28日土曜日
41. RubyConf
also available in
sub resources
URL name method action
/books/:id/tags/edit edit_book_tags GET edit_tags
/books/:id/tags PUT update_tags
book_tags
/books/:id/tags DELETE destroy_tags
株式会社 万葉
2009年11月28日土曜日