[RUBY] Install Rails in the development environment and create a new application

Quote Rails Tutorial

Install Rails

Set .gemrc file not to install Ruby documentation

$ echo "gem: --no-document" >> ~/.gemrc

To install Rails, use the gem command. I've added settings to the command to avoid wasting time installing Ruby documentation.

Install Rails by specifying the version

$ gem install rails -v 6.0.3

Installed with version 6.0.3

$ rails -v
# Rails 6.0.3

Check the version (check if it matches if specified and installed)

Install Yarn to manage JavaScript software dependencies

$ source <(curl -sL https://cdn.learnenough.com/yarn_install)

* When a warning message appears

========================================
  Your Yarn packages are out of date!
  Please run `yarn install --check-files` to update.
========================================
$ yarn install --check-files

Do the above and it's OK


Create a new app

Create an environment directory for your Rails project

$ cd                    #Move to project home directory
$ mkdir environment     #Create environment directory
$ cd environment/       #Move to the created environment directory

run rails new

$ rails _6.0.3_ new <app name>

Role of each folder

Quote Rails Tutorial Table 1.2: Overview of Default Rails Directory Configuration (https://railstutorial.jp/)

directory Use
app/ Key application code including models, views, controllers, helpers, etc.
app/assets Assets such as CSS (Cascading Style Sheet), JavaScript files, images used in the application
bin/ Binary executable
config/ Application settings
db/ Database related files
doc/ Application documentation, such as manuals
lib/ Library and module storage
log/ Application log file
public/ Data to be published directly to the general public (Web browser, etc.) such as error pages
bin/rails Rails scripts used for code generation, console launch, local web server launch, etc.
test/ Application testing
tmp/ temporary file
README.md A brief description of the application
Gemfile Gem definition file required for this application
Gemfile.lock List to check the version of gem used by the application
config.ru Configuration file for Rack middleware
.gitignore A pattern for specifying files that you don't want to include in Git

Run Bundler

A bundler is a gem that manages gem versions and gem dependencies. By using bundler, you can develop with multiple people or even if the gem version goes up without causing an error.

Enter the gem to use in the Gemfile

Since the gem used differs depending on each development environment, enter the required gem. (Example bootsnap, byebug, etc.)

install bundle

$ cd hello_app/
$ bundle install

If you get an error saying [bundle update], run bundle update first


This is the environment construction.

Recommended Posts

Install Rails in the development environment and create a new application
Create a new app in Rails
Create a development environment for Ruby 3.0.0 and Rails 6.1.0 on Ubuntu 20.04.1 LTS
Install Ubuntu 20.04 in virtual box on windows10 and build a development environment using docker
How to install Docker in the local environment of an existing Rails application [Rails 6 / MySQL 8]
Introducing the settings and reference articles that are first done in Rails new development
[Rails] Create new files required for the application at once
Create a Java and JavaScript team development environment (gradle environment construction)
Preparing to create a Rails application
Create a database in a production environment
[Rails 6.0, Docker] I tried to summarize the Docker environment construction and commands necessary to create a portfolio
Click the [rails] button to create a random alphanumeric password and enter it in the password field
Install Cloud9 on Raspberry pi 4 and set up Rails development environment
Procedure for building a Rails application development environment with Docker [Rails, MySQL, Docker]
Build a browser test environment using Capybara in the Docker development environment
How to install the language used in Ubuntu and how to build the environment
When log data accumulates in Rails and the environment stops working
Let's create a TODO application in Java 5 Switch the display of TODO
We will build a Spring Framework development environment in the on-premises environment.
Let's create a Java development environment (updating)
Creating a Servlet in the Liberty environment
Rails Basics of creating a new application
[Rails 5] Create a new app with Rails [Beginner]
[Rails] Reset the database in the production environment
Java application development environment created in VM environment
Install Docker and create Java runtime environment
Let's install Docker on Windows 10 and create a verification environment for CentOS 8!
I tried to build a Firebase application development environment with Docker in 2020
[Docker] How to create a virtual environment for Rails and Nuxt.js apps
[Rails] How to create a table, add a column, and change the column type
[Rails] I studied the difference between new method, save method, build method and create method.
Create a java web application development environment with docker for mac part2
Have a tool to create and open a new canvas in Mac preview
Nuxt.js × Create an application in Rails API mode
Build a development environment for Docker + Rails6 + Postgresql
Create authentication function in Rails application using devise
[Rails / ActiveRecord] About the difference between create and create!
[Rails] rails new to create a database with PostgreSQL
Error in bundle install when running rails new
(Basic authentication) environment variables in rails and Docker
How to easily create a pull-down in Rails
Rails6.0 ~ How to create an eco-friendly development environment
Rails development environment created with VSCode and devcontainer
A reminder of Docker and development environment construction
A note about the Rails and Vue process
[Rails] Difference between create method and new + save method
[Beginner] Install java development tool in cloud9 development environment.
Create a Spring Boot development environment with docker
Let's make a calculator application with Java ~ Create a display area in the window
Create a Windows desktop application in Ruby and distribute an executable file (.exe)!
[Java] [POI] Create a table in Word and start a new line in one cell
A memo to simply create a form using only HTML and CSS in Rails 6
Introduce Docker to the development environment and test environment of existing Rails and MySQL applications
Find out about Rails hidden_field (create a confirmation screen and check the behavior)
Create a drag-and-drop markdown editor in Rails 6 (using Active Storage, SimpleMDE and Inline Attachment)
Create a Java development environment using jenv on Mac
[Introduction] Try to create a Ruby on Rails application
How to create a Java environment in just 3 seconds
Build a Ruby on Rails development environment on AWS Cloud9
[Rails] [Docker] Copy and paste is OK! How to build a Rails development environment with Docker
Docker the development environment of Ruby on Rails project