Help us understand the problem. What is going on with this article?

Rails5.0 基本事項まとめ 〜①よく使うコマンド編〜

More than 3 years have passed since last update.

概要

ターミナルでRailsを操作する時によく使うコマンド一覧です。

Rails-Command

新規アプリケーションの作成

$ rails new <appName>

MySQL Ver.

$ rails new <appName> -d mysql

サーバ起動

$ rails s(erver)

マイグレーションスクリプトを実行

$ rails db:migrate

雛型ファイルの作成

Migration

$ rails g migration AddAuthorToBooks author:string

カラム名と型の間にはスペースを開けない事。

Model + Migration

$ rails g model book title:stirng memo:text

Routes + Controller + View

$ rails g controller books index

Scaffold = Model + Migration + Routes + Controller + View

$ rails g scaffold book title:string memo:text

railsリソースの削除

$ rails d(estroy) <Resource>

1行ずつコードを実行

$ rails c(onsole)
tfrcm
React / ReactNative / Go / TypeScript / AWS / Docker / k8s
https://gemcook.com
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした