Rails 的 API
时间:2018-07-04 17:13:09
收藏:0
阅读:164
位置:自我练习/weather
Readme.rb
建立了2个model, Location, recording. 一对多关联
建立了2个controller,继承关系
ApiController
ApiController::Api::V1::LocationsController
建立了一个show.json.jbuilder.
如果像这样,没有明确指定1.json格式:
http://localhost:4000/api/v1/locations/1
则会使用ApiController的默认设置:
“request.format = :json”
原文:https://www.cnblogs.com/chentianwei/p/9264156.html
评论(0)