Rails POST, PUT, GET

前端 未结 8 1354
伪装坚强ぢ
伪装坚强ぢ 2020-12-12 14:14

After I generate a scaffold, Rails gives me the ability to POST to items.xml which will create a new item. A GET to items.xml will sim

8条回答
  •  再見小時候
    2020-12-12 15:06

    Like Don Werve said, take a look at your routes.rb file. In there you probably have something like this:

    map.resources :items
    

    This is where rails links the POST and GET requests to certain actions. To see how this works look at the links from the other answers. The docs help a ton.

    To all the routes and which actions they link to you can type rake routes into the command prompt when you are in the root of your rails directory. This will show you everything (in terms of routing) that a scaffold gives you.

提交回复
热议问题