[RUBY] It's just now, but a collection of commands that frequently appear in Rails

Introduction

Every time I created an application, I checked the curriculum, so I'll summarize it here for you to remember.

Create a new application

rails new application name-option

You can also specify the rails version before new. ex)_6.0.0_ A database management system can be specified as an option. ex)-mysql

Creating a new database

rails db:create

Server startup

rails s

You can do it in another tab with command + T. Stop the server with "control + C".

Controller generation

rails g controller controller name (plural)

By leaving a space after the controller name and adding the action name, it is generated with the action described in the controller.

Model generation

rails g model model name (singular)

Check routing

rails routes

Check the URI, path, and action.

Create table

rails db:migrate

After modifying the migration file, execute it.

Send back the migration file

rails db:rollback

When you want to modify the migration file, you need to send it back once.

Check the migration status

rails db:migrate:status

Check if the migration has been completed. up or down

Recommended Posts

It's just now, but a collection of commands that frequently appear in Rails
A collection of commands that were frequently used on heroku
A collection of RSpecs that I used frequently
Summary of frequently used commands in Rails and Docker
It's just now, but it's slimy
[Rails] A collection of tips that are immediately useful for improving performance
A collection of methods that replace characters entered in hashtag search with a nice feeling
One case of solving a migration error in Rails
[Rails] Volume that displays favorites and a list of favorites
Generate a unique collection of values from a collection that contains duplicate values
Determine that the value is a multiple of 〇 in Ruby
A collection of Eclipse shortcuts that new graduates find useful
A program that counts the number of words in a List