[Ruby] Chewing the Rails Tutorial [Chapter 1 From Zero to Deployment] First Half

2 minute read

1.1 Introduction

■ REST “Create/Read/Update/Delete” which is often used in SQL is applied to “GET/POST/PUT/DELETE” respectively. It is necessary to write each command one by one because it does not manage the state of sessions. Basically, describe in “route.rb”.

■ Command line Terminal. Comes standard with cloud IDEs.

1.2 Move immediately

■Cloud9 An integrated development environment that can be developed on the cloud provided by AWS. Super convenient because it does not require complicated environment settings

■ gem Patch file? Additional element? Something like If you enter it in a file called “Gemfile” and type in bundle install and the terminal, it will be installed automatically.

1.3 First application

■ rails new The first spell to write when building an application using Rails. It will automatically generate the necessary files.

■ Framework Rails is the framework. If you have an editor, you can program freely, but in the future it will be a messy writing style, so let’s align the writing style to some extent. If you use Rails, you can do the same process with dozens of lines if you write it in Ruby with your own short expression. I don’t have the actual value yet.

■ Version for each game The behavior may differ if the version is different, so it is better to fix the version before development. If spring 2.0.2 cannot be installed, hit “bundle update spring” and then install again.

[Practice] It’s written before the rails server was launched.

■ MVC model A concept that defines where to put which file. Originally, you can put anything anywhere, but since it will be troublesome to manage it later, I will write it with some uniformity. There is no real sense of where to write what.

■ render method Method that outputs the response. Use in both controller and view.

■ Method function. It is used by sandwiching it between def and end. When calling, write the defined method name.

■ routes.rb Describe which page is returned for which request. Is the controller basically listed?

■ 1.3.4 Rewrite to Hello, world! Rewrite the first “Yay! You’re on Rails!” to Hello, world!. This time it’s not a big deal, so you probably won’t mess with the view. Define the render method that displays the HTML “hello, world!” in the controller, Make root a hello method.


  1. You can change the text
  2. Since it’s Windows, I don’t know how to display it, so skip it. 3.


def goodbye
    render html: "goodbye, world!"


Rails.application.routes.draw do

Like this.