・ Rails tutorial is the 4th edition ・ This study is the 3rd lap (2nd lap after Chapter 9) ・ The author is a beginner who has done all of Progate.
・ If you read it, you will not understand it. ・ Search and summarize terms that you do not understand (at the bottom of the article, glossary). ・ Dive into what you do not understand. ・ Work on all exercises. ・ Do not copy chords as much as possible.
Then go-go.
In Chapter 1, create the first "hello_app" -version control using Git-deploy to the production environment. In Chapter 2, scaffold is used to automatically generate code and create a "toy_app". From Chapter 3 to the last 14 chapters, create a twitter-like "sample_app" from scratch.
Although it is a tutorial, it is difficult without any prerequisite programming knowledge, so let's do the related course of Progate (charged).
[Progate course related to Rails tutorial] ·Chapter 1 Command line Git ・ Chapter 4 Ruby ・ Chapter 5 HTML & CSS Sass ・ Chapter 14 jQuery JavaScript SQL Rails basics Ruby on Rails
(I realize I'm not doing the Sass course here. I'll do it before I start Chapter 5.)
Which website has the Ruby gem used for Ruby on Rails? Tip: If you don't know, just google. → Result of google
What is the latest version of Rails at the moment? → 6.0.3.2 (with 2020/6/17)
How many times has Ruby on Rails been downloaded so far? Please check it out. → Cumulative download count: 239,792,613 (as of August 31, 2020)
$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
$ rails -v
Rails 5.1.6
Let's rewrite the hello action in Listing 1.7 so that "hola, mundo!" Is displayed instead of "hello, world!". → Rewrite the contents of the hello method of application_controller to "hola, mundo!"
Rails also supports "non-ASCII characters". "¡Hola, mundo!" Contains the Spanish-specific upside-down exclamation mark "¡". To display the "¡" character on your Mac, hold down the Option key and press the 1 key. It may be faster to copy this character and paste it into your editor. → Above. Added
Refer to the hello action in Listing 1.7 and add the second action goodbye. This action displays the text "goodbye, world!". Edit the routing in Listing 1.9 to change the route routing assignment from the hello action to the goodbye action. → Below
routes.rb
Rails.application.routes.draw do
root 'application#goodbye'
end
application_controller.rb
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def hello
render html: "¡hola, mundo!"
end
def goodbye
render html: "goodbye, world!"
end
end
【1.4.3 Bitbucket】 The 4th edition of the tutorial uses Bitbucket as the report repository, but I feel that GitHub is more common, so I will challenge it. ・ ・ ・ ・ ・ ・
I was able to push it to GitHub without difficulty. (After that, I had a little trouble registering the public key while pushing)
Make the same changes as 1.3.4.1 so that "hola, mundo!" Can be displayed in the production application. → Returned the routing action to hello from the previous exercise, and corrected the render of the application controller to hola, mundo !. Commit again → Push to remote repository → Deploy to heroku.
As with 1.3.4.1, change the routing to the route so that the result of the goodbye action is displayed. Also, when deploying, dare to omit the Git push master and make sure you can deploy with git push heroku. → Since I was doing the exercise (1.3.4) earlier, the result has been displayed. I changed it in Exercise 1, so I omitted it because it is annoying.
Execute the heroku help command to display a list of Heroku commands. Which command is the command to view the logs for the Heroku app? → heroku logs
Use the commands found in the exercise above to check the recent log of the Heroku app. What was the most recent event? (Remembering the command to look at this log will help you find bugs in your production environment) → app [api]: Build succeeded?
-For the time being, set the root and action of the route, Hello, world! -Version control with Git. The remote repository uses GitHub, which is not used in the 4th edition of the tutorial. -Deploy to Local → Remote → Heroku! -For the database, sqlite3 is used in the development environment and PostgreSQL is used in the production environment.
⇨ Go to Chapter 2! Click here for premise and author status for learning
-Deploy Make the system such as a web application available from the outside. Reflect the system in the development environment → staging environment, staging environment → production environment.
・ Staging environment The stage of making a final check on the operation and display before releasing the system.
・ Commit Save the directory change history in the local repository (work environment: your PC).
・ Push Uploading committed data from a local repository to a remote repository (GitHub, Bitbucket, etc.).
・ Merge The meaning of "fusion" in Japanese. In other words, merge the changed topic branch with the master branch. Deleting a topic branch is optional.
Recommended Posts