[RUBY] [Rails] Creating a new project with rails new

Introduction

Since I'm supposed to forget how to add options and specify the version every time, I will also summarize the rails new surroundings as a memorandum.

Create a new project

① Check the version of installed rails

$ gem search ^rails$ -l

*** LOCAL GEMS ***

rails (6.0.3.4, 6.0.3.2, 6.0.2.1, 6.0.0)

You can use the version shown here to create a Rails application.

② Create a new project

$rails new Project name to create

You can launch a new project by entering the rails new command.

③ Move to the created project

$cd project name

Change to the directory of the project you created using the cd command.

④ Start the local server

rails server
Or
rails s

You can set up a local server.

=> Booting Puma
=> Rails 6.0.3.4 application starting in development 
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 3.12.6 (ruby 2.6.5-p114), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop

Is displayed, the startup is successful.

⑤ Display the default page

In your browser http: // localhost: 3000 / To access If the You ’re on Rails !! screen appears, it's OK!

Delete project

① Delete database

$ rails db:drop

If you are creating a database, you must first delete it with this command.

② Delete the directory

rm -r directory name

You can delete it with this command. You can erase it with the viewfinder.

Frequently used options

Database specification

(When Mysql is specified)
Rails new project name-d mysql
Or
Rails new project name — database=mysql

The default database is SQLite3. If you want to change to Mysql or potgresql, it is easy to specify it first.

Specifying the version

Rails _6.0.0_new project name

By default, the latest installed version of rails will be launched. If you need to specify the version, specify it first.

Recommended Posts

[Rails] Creating a new project with rails new
[Rails] Launch a new project
[Rails6] Create a new app with Rails [Beginner]
Rails Basics of creating a new application
[Rails 5] Create a new app with Rails [Beginner]
Naming convention when creating a new controller or model with rails
Creating a new user with rails was angry with unknown attribute'password' for User.
[Rails] rails new to create a database with PostgreSQL
[Rails] Creating a search box
[Beginner] I stumbled upon launching a project with Rails6
How to get started with creating a Rails app
Build a Java project with Gradle
Creating a timer app with a muddy
Create a new app in Rails
Create a Maven project with a command
[Rails] Avoid SELECT issued when creating a model with belongs_to defined!
I got a warning message with the rails _6.0.3_ new hello_myapp command
[Rails withdrawal] Create a simple withdrawal function with rails
Create a temporary class with new Object () {}
Make a login function with Rails anyway
Make a site template easily with Rails
Change from SQLite3 to PostgreSQL in a new Ruby on Rails project
Add .gitignore when creating a project in Xcode
Creating a browser automation tool with Ruby + Selenium
Create a team chat with Rails Action Cable
rails new app is not created with app name
Let's make a search function with Rails (ransack)
Add a project in any folder with Gradle
(Ruby on Rails6) Creating data in a table
[Rails] Creating a breadcrumb trail using Gem gretel
I made a LINE bot with Rails + heroku
[For beginners] Procedure for creating a controller using rails
Creating a common repository with Spring Data JPA
I made a portfolio with Ruby On Rails
From creating a Spring Boot project to running an application with VS Code
Creating a Dockerfile with all AWS CloudFormation test tools
Create an EC site with Rails 5 ⑨ ~ Create a cart function ~
How to delete a new_record object built with Rails
Display a confirmation screen before registering a record with rails
Rails deploy with Docker
Creating a Cee-lo game with Ruby 4th Creating a game progress process
[Rails 6] RuntimeError with $ rails s
How to manually generate a JWT with Rails Knock
Creating a local repository
Handle devise with Rails
[Rails] Learning with Rails tutorial
[How to insert a video in haml with Rails]
[Rails] Test with RSpec
A memorandum when creating a REST service with Spring Boot
Creating a test case
[Rails] Development with MySQL
Supports multilingualization with Rails!
Docker command to create Rails project with a single blow in environment without Ruby
Double polymorphic with Rails
[Review] When creating a web application with Rails, syntax error, unexpected')', expecting => ...]}% ","% # {params [: content]}% "]) ...
[Java] How to start a new line with StringBuilder
Tutorial to create a blog with Rails for beginners Part 1
I made a development environment with rails6 + docker + postgreSQL + Materialize.
Add a local Swift Package to your project with Swift PM
Rough procedure verbalized output when creating an app with Rails
[Rails] I tried to create a mini app with FullCalendar