4.RubyonRails控制器(Controller)之路由(Routing)

1.资源路由

resoures :photos
HTTP VerbPathController#ActionPath Helper
GET/photosphotos#indexphotos_path
GET/photos/newphotos#newnew_photo_path
POST/photosphotos#createphotos_path
GET/photos/:idphotos#showphoto_path
GET/photos/:id/editphotos#editedit_photo_path
PATCH/PUT/photos/:idphotos#updatephoto_path
DELETE/photos/:idphotos#destroyphoto_path

2.非资源路由

get 'profile', to: 'users#show'       #对应profile_path

原创文章,作者:huoxiaoqiang,如若转载,请注明出处:https://www.huoxiaoqiang.com/ruby/rubyonrails/3381.html

发表评论

登录后才能评论