Ruby on Rails Overview (Beginner Summary)


I tried to summarize Ruby on Rails so that a fledgling engineer who has been programming for the first time for 2 months is literally a beginner's point of view and even a beginner can understand as much as possible. I would appreciate it if you could point out any mistakes.

What is Ruby on Rails?

It is an application framework based on Ruby. In the first place, a framework is simply a "framework", a "framework", and a "template", and the basic things needed to create an app are prepared in advance. It's very convenient because it reduces the development cost because you don't have to develop from scratch. Rails Way Rails uses flexible and free Ruby for a kind of fixed rail called a framework, and it can be said that "the good points of the framework" and "the freedom to write your own code" are compatible. Based on this, it is important to think like Rails and write Rails-like code. By doing so, the code will be clean and easy to read, and productivity will naturally increase.

Rails philosophy

I would like to introduce two typical ones, which are similar to the common philosophy that corresponds to the Rails-like code mentioned above.

DRY (Don't Repeat Yourself) Repeats and duplications are not beautiful as code

__ Convention over configuration __ Instead of writing a large amount of settings as in the conventional framework, it is made simple by hijacking the convention.

What is MVC

Now that we've briefly talked about Rails, let's finish with MVC. MVC is one of the patterns of thinking about how to structure software. Even in an application composed of various processes, the UI (user interface) part has different properties, so if you write it together, the code will be complicated. Therefore, "__ UI related part (view) ", " application-specific processing and data handling (model) ", and " these two bridging behavior (controller) __" MVC (Model View Controller) makes it easier to manage by dividing it into two roles.

There is routing in the controller that acts as a bridge. This is where __ decides which controller (class) and which action (method) is in charge of processing based on the URL or HTTP request received from the browser __. The figure is as follows. スクリーンショット 2020-12-25 2.36.06.png

The processing corresponding to each number is explained. (1) Requests from the browser (client) are passed via the web server. (2) Identify the controller and action to be processed based on the URL received by the routing function and call the action. ③ In the action, use the model as needed. (Getting data from the database, etc.) (4) The model also writes and calls to the database as needed. ⑤ Create HTML using the view template corresponding to each action. ⑥ The controller creates a response and returns it to the browser.

This MVC is a very important concept in Rails, so let's understand it well.

Reference books

Compatible with Ruby on Rails 5 Quick Learning Practice Guide 5.2 that can be used in the field

Recommended Posts

Ruby on Rails Overview (Beginner Summary)
Ruby on Rails validation summary
Ruby on Rails variable, constant summary
Deploy to Heroku [Ruby on Rails] Beginner
Ruby on Rails Elementary
Ruby on Rails basics
Ruby On Rails Association
[Beginner Procedure Manual 2] Ruby on Rails: Rails template creation
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 basic learning ①
[Ruby on Rails] about has_secure_password
Ruby on rails learning record-2020.10.07 ②
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 Basic Memorandum
Method summary to update multiple columns [Ruby on Rails]
Ruby on Rails Refactoring method example summary around MVC
[Ruby on Rails] Read try (: [],: key)
[Ruby on Rails] yarn install --check-files
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
Ruby on Rails for beginners! !! Summary of new posting functions
How to use Ruby on Rails
[Ruby on Rails] Add / Remove Columns
Ruby on Rails Japanese-English support i18n
(Ruby on Rails6) "Erase" posted content
[Ruby on Rails] CSV output function
Ruby on Rails 6.0 environment construction memo
[Ruby on Rails] What is Bcrypt?
[Ruby on Rails] Confirmation page creation
Ruby On Rails devise routing conflict
[Ruby on Rails] Comment function implementation
[Ruby on Rails] DM, chat function
[Ruby on Rails] Convenient helper method
Beginner Ruby on Rails What I learned is being summarized
[Ruby on Rails] Stop "looping until ..."
Ruby on Rails for beginners! !! Post list / detailed display function summary
[Ruby on Rails] "|| =" ← Summary of how to use this assignment operator
[Ruby on Rails] Introduction of initial data
[Ruby on Rails] Search function (not selected)
[Rails] Addition of Ruby On Rails comment function
[Ruby on Rails] Creating an inquiry form
Ruby on Rails6 Practical Guide cp13 ~ cp15 [Memo]
[Ruby on Rails] View test with RSpec
[Ruby on Rails] How to use CarrierWave
[Ruby on Rails] Code check using Rubocop-airbnb
[Ruby on Rails] 1 model CRUD (Routing Main)
Ruby on Rails installation method [Mac edition]
[Ruby on Rails] model, controller terminal command
Let's summarize "MVC" of Ruby on Rails
Ruby on Rails model creation / deletion command