scaffold
bash
rails g scaffold User name:string score:integer
Controller. controller name is plural.
bash
rails g controller Projects
Model. Model name is singular.
bash
rails g model Task title done:boolean project:references
カラムの型
データ | 説明 |
---|---|
string | 文字列 |
text | 長い文字列 |
integer | 整数 |
float | 浮動小数 |
decimal | 精度の高い小数 |
datetime | 日時 |
timestamp | より細かい日時 |
time | 時間 |
date | 日付 |
binary | バイナリデータ |
boolean | Boolean型 |
You can see here.