スポンサーリンク

O’REILLYのLearning-Rails-5をやってみる(5)ScaffoldingとREST

前回は、Chapter4までやった。

http://twosquirrel.mints.ne.jp/?p=10637

今回は、Chapter5. Accelerating Development with Scaffolding and REST をやってみたい。

公式ソースコード https://github.com/bbulpett/LR5

(環境)
Windows8.1
VirtualBox, Vagrant, Ruby2.3.1, Rails5.0.0.1
VisualStudioCode, PuTTY
ホストOS:C:/vm/rails5/ <=> ゲストOS:/vagrant/

(1)puttyで、

rails g scaffold Person name:string
rails db:migrate
rails s -b 0.0.0.0

image

image image

image image

image image

app/controllers/people_controller.rb は以下のような感じ。
image

rails routes で、ルーティングを確認することができる。

image

json形式でも出力できる。(JSON形式?何それ?おいしいの?)

image

スポンサーリンク