0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

RubyOnRailsコマンド一覧①

Last updated at Posted at 2020-10-01

railsのコマンドを色々まとめて見ようと思います。

常用コマンド

まず基本的に使うコマンドについてさっと載せます。

# 一覧,作成,起動
rails --help
rails new app_name
rails server

# 各種機能作成
rails generate
rails db:migrate
rails db:create

# 機能チェック
rails test
rails routes
rails dbconsole
rails console

コマンド入力の省略ができるエイリアスはこちら

エイリアス
rails server    => rails s
rails generate  => rails g
rails console   => rails c
rails dbconsole => rails db

一覧,作成,起動

まず最も基本的な内容から

コマンド一覧

rails --help

アプリ作成

rails new app_name

アプリ起動

rails server
# エイリアス
rails s

各種機能作成

コントローラー,モデル作成

rails generate
# エイリアス
rails g

使用例

rails g controller 名前
rails g モデル 名前

データベース作成

rails db:create

データベース更新

rails db:migrate
0
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?