Rails new in Ruby on Rails ~ Memorandum until deployment 1

It is a memorandum from Rails new to deployment in Ruby on Rails!

I will divide it into several times and write a series from application creation to deployment with the Rails new command. The first time, I will write from Rails application template creation to push to a remote repository.

I would be grateful if you could let me know if there are any missing points or mistakes.

environment

Development environment Language: Ruby 2.5.1 FW:Ruby on Rails 5.2.4 DB:PostgreSQL test:RSpec Version control: Git, GitHub

Environment: MacBook Air

Rails app creation

Create a directory for your application using the Rails new command!

Terminal.


rails new <App_name> -option

Actually I wanted to use PostgreSQL for the DB, so I entered the following command and incorporated it into the application first. (Can be changed later)

Terminal.


rails new App_name -d postgresql

This will create the directories needed for your Rails application.

After creating, use the cd command to move from the current directory to the directory you created earlier.

Terminal.


 cd App_name

Now, let's create a DB!

Terminal.


 rails db:create

This will create the DB.

Terminal.


 rails s

Launch Rails server http://localhost:3000 Access from your browser!

Did you confirm that the server started up correctly? By the way, you can end it with control + c.

Start managing Git

Get started with Git!

Terminal.


git init

Now you're ready to manage Git. Git related directories are set as hidden directories, so you may want to visualize them with command + shift +.

Stage your application I usually check the status (git status) and diff (git diff) before staging, but I will omit it. (Check the status of the changed file)

Terminal.


git add .

Stage all modified files with add. (Dot). In this case, all the files created by Rails new!

Terminal.


git commit -m "first commit"

Record your changes with the command above! The -m after commit is optional and is an option to leave a comment! It's always decided to leave a comment when committing, so add it so you can understand what you've changed.

Next, push to the remote repository!

After creating a remote repository on GitHub

Terminal.


git push

I get angry when I hit. In short, I don't know where to connect to the remote repository, so I'll tell you. (In addition to being angry, you will be asked to enter the following command)

Terminal.


git remote add <name> <url>

If you write it like an actual command ↓

Terminal.


git remote origin https://github.com/×××

This is OK The rest is pushed with the following command.

Terminal.


git push -u origin master

The above command is used only for the first time, but after the second time, just git push is OK! The same is true when cutting a branch.

That's all for this time. I wrote it as a memorandum for myself, Thank you for visiting!

Recommended Posts

Rails new in Ruby on Rails ~ Memorandum until deployment 2
Rails new in Ruby on Rails ~ Memorandum until deployment 1
Ruby on Rails Basic Memorandum
[Ruby on Rails] Stop "looping until ..."
Ruby on Rails in Visual Studio Codespaces
Ruby on Rails application new creation command
Beginners create portfolio in Ruby on Rails
I summarized the flow until implementing simple_calendar in Ruby on Rails.
Change from SQLite3 to PostgreSQL in a new Ruby on Rails project
[Ruby on Rails] Until the introduction of RSpec
Recommendation of Service class in Ruby on Rails
Ruby on Rails Elementary
[Ruby on Rails] A memorandum of layout templates
Ruby on Rails basics
(Ruby on Rails6) Creating data in a table
Ruby On Rails Association
[Ruby on Rails] How to install Bootstrap in Rails
[Ruby on Rails] How to write enum in Japanese
[Ruby on Rails Tutorial] Error in the test in Chapter 3
[Ruby On Rails] How to reset DB in Heroku
[Ruby on Rails] Post image preview function in refile
Ruby on rails learning record -2020.10.03
Portfolio creation Ruby on Rails
Ruby on rails learning record -2020.10.04
[Ruby on Rails] Debug (binding.pry)
Ruby on rails learning record -2020.10.05
Ruby on rails learning record -2020.10.09
Ruby on Rails config configuration
[Ruby on Rails] about has_secure_password
Commentary on partial! --Ruby on Rails
Ruby on rails learning record-2020.10.07 ①
Cancel Ruby on Rails migration
Ruby on rails learning record -2020.10.06
Ruby on Rails validation summary
Difficulties in building a Ruby on Rails environment (Windows 10) (SQLite3)
Definitely useful! Debug code for development in Ruby on Rails
Ruby on Rails for beginners! !! Summary of new posting functions
[Apple login] Sign in with Apple implementation procedure (Ruby on Rails)
How to display a graph in Ruby on Rails (LazyHighChart)
Apply CSS to a specific View in Ruby on Rails
Ruby on Rails Overview (Beginner Summary)
[Ruby on Rails] Read try (: [],: key)
[Ruby on Rails] yarn install --check-files
Ruby on Rails variable, constant summary
Installing Ruby + Rails on Ubuntu 18.04 (rbenv)
[Ruby on Rails] Introduced paging function
Basic knowledge of Ruby on Rails
Progate Ruby on Rails5 Looking Back
How to use Ruby on Rails
[Ruby on Rails] Add / Remove Columns
(Ruby on Rails6) "Erase" posted content
Ruby on Rails 6.0 environment construction memo
[Ruby on Rails] What is Bcrypt?
Launch Rails on EC2 (manual deployment)
[Ruby on Rails] Confirmation page creation
[Today's stack # 1] Until on rails on cloud9
Ruby On Rails devise routing conflict
[Ruby on Rails] Comment function implementation
[Ruby on Rails] DM, chat function
[Ruby on Rails] Convenient helper method
Ruby methods often used in Rails