About Resouce_Ruby_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > Ruby > About Resouce

About Resouce

 2010/12/5 13:14:33  vivei  http://vivei.javaeye.com  我要评论(0)
  • 摘要:关于RESTful风格的URL设计Singular(单数)resourcefulroute:resource:geocodercreatessixdifferentroutesinyourapplication,allmappingtotheGeocoderscontroller
  • 标签:

?

关于RESTful风格的URL设计

?

Singular(单数)

?

resourceful route:

?

resource :geocoder

?

creates six different routes in your application, all mapping to the Geocoders controller:

Verb Path action method used for GET /geocoder/new new new_geocoder_path return an?HTML?form for creating the geocoder POST /geocoder create geocoder_path create the new geocoder GET /geocoder show geocoder_path(id) display the one and only geocoder resource GET /geocoder/edit edit edit_geocoder_path(id) return an?HTML?form for editing the geocoder PUT /geocoder update geocoder_path(id) update the one and only geocoder resource DELETE /geocoder destroy geocoder_path(id) ? ? ? ? delete the geocoder resource


Plural(复数)

resourceful route:

?

resources :photos

?

creates seven different routes in your application, all mapping to the Photos controller:

Verb Path action method used for GET /photos index photos_path display a list of all photos GET /photos/new new new_photos_path return an?HTML?form for creating a new photo POST /photos create photos_path create a new photo GET /photos/:id show photo_path(id) display a specific photo GET /photos/:id/edit edit edit_photo_path(id) return an?HTML?form for editing a photo PUT /photos/:id update photo_path(id) update a specific photo DELETE /photos/:id destroy photo_path(id) ? ? ? ? delete a specific photo

(continue)

---------------------------------------------------------------------------------------------------

参考

Rails Routing from the Outside In

http://guides.rubyonrails.org/routing.html#nested-names

?

Nesting resources

http://weblog.jamisbuck.org/2007/2/5/nesting-resources

上一篇: Ruby截windows屏 下一篇: Heroku部署记录下
  • 相关文章
发表评论
用户名: 匿名