This is a continuation of Tutorial 1 to create a blog with Rails for beginners. Last time, I decided what to make. This time, we will do the initial setup of the project before moving on to implementation.
This time we will do the following work
--Create a repository on Github --Install rails --rails project setup
If you haven't built a Ruby environment yet, please set up a Ruby development environment by referring to the following pages.
--Mac Edition: https://prog-8.com/docs/ruby-env --Windows: https://prog-8.com/docs/ruby-env-win
At this time, let's set gitignore to rails
[^ 1]
[^ 1]: Doing this is useful because it ignores files that tend to be generated by rails but don't need (or shouldn't) be managed by git.
gem install rails
Now you're ready to set up your rails project.
git clone https://github.com/account name/rails-blog-sample.git
This will clone the repository at hand
cd rails-blog-tutorial
rails new .
You will be asked if you want to overwrite some files in rails new
, so you can answer all with y
.
If the following atmosphere log is displayed on the console with rails server
, try accessing http: // localhost: 3000 / with your browser.
If you see a screen like Yay! You ’re on Rails!
, You are successful. Exit with ctrl -c from the terminal
On the contrary, if it doesn't look like this, something is wrong. At that time, try google or ask a part of the error message.
=> Booting Puma
=> Rails 6.0.3.1 application starting in development
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 4.3.5 (ruby 2.5.5-p157), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://127.0.0.1:3000
* Listening on tcp://[::1]:3000
Use Ctrl-C to stop
Now that we have created a rails project to develop our blog, we will push (upload) our work on github.
git add .
git commit -m 'rails new'
git push origin master
Now, even if the file at hand disappears, you can get the work contents so far from github. In this way, let's commit and push the work contents diligently.
--I made a repository on Github and cloned it at hand
--I installed rails
--I was able to check the operation with rails server
after building the project with rails new
Next time, I will implement the "model" part that is needed to handle data in a web application.
Recommended Posts