2
1

More than 3 years have passed since last update.

modelの作成

Posted at

modelの作成方法

model作成のコマンド

$ rails g model モデル名

model名のところは単数系でなければならない

model作成時のルールなので気をつけましょう。

boardsテーブルを作りたい時は
例) $ rails g model board

と実行する

マイグレーションファイルなどが生成される。

マイグレーションファイルを編集します

編集し終わったら以下のコマンドでテーブルを作成します。

$ rails db:maigrate
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1