### 環境構築
$ ruby -v
$ rbenv install –list
$ rbenv install 2.7.2
$ sudo apt install sqlite3
$ sqlite3 –version
3.31.1 2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837balt1
$ gem install rails -v 5.1.3 –no-document
$ sudo apt install ruby-railties
$ rails -v
Rails 5.1.3
### railsアプリ
$ rails new myapp
$ rails server -b 192.168.33.10 -d
=> Booting Puma
=> Rails 5.1.7 application starting in development
=> Run `rails server -h` for more startup options
サーバーのdown
$ cat tmp/pids/server.pid
24555
$ kill -9 24555
ログ
$ tail log/development.log
### scaffold
$ rails g scaffold Memo title:string body:text
$ rails db:migrate
http://192.168.33.10:3000/memos
$ ps aux | grep puma
$ kill -9 24777
app, config, dbなどを主に使用する
### model作成
単数系になる
$ rails g model Post title:string body:text
$ rails db:migrate
### データ挿入
$ rails c
$ p = Post.new(title:’title1′, body:’body1′)
$ p.save
$ Post.create(title:’title2′, body:’body2′)
$ Post.all
$ quit