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.
$ 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.
$rails new Project name to create
You can launch a new project by entering the rails new
command.
$cd project name
Change to the directory of the project you created using the cd
command.
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.
In your browser http: // localhost: 3000 / To access If the You ’re on Rails !! screen appears, it's OK!
$ rails db:drop
If you are creating a database, you must first delete it with this command.
rm -r directory name
You can delete it with this command. You can erase it with the viewfinder.
(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.
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