Rails 的 API

位置:自我练习/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”

猜你喜欢

转载自www.cnblogs.com/chentianwei/p/9264156.html