Before attempting to follow along. Please ensure you have the following requirements:
Rails v5+
Ruby v 2.4+
sqlite3
brew install sqlite3
This guide is intended to walk you through a basic rails application walkthrough and give some context as to why we do them this way.
Rails comes with a number of scripts called generators that are designed to make your development life easier by creating everything that's necessary to start working on a particular task. One of these is the new application generator, which will provide you with the foundation of a fresh Rails application so that you don't have to write it yourself.
To use this generator, open a terminal to the directory you want the project to live in. The run the following command:
rails new todo_app
This will create a Rails application called Todo in a todo_app directory and install the gem dependencies that are already mentioned in Gemfile using bundle install.
After you create the blog application, cd
into into its folder.
The blog directory has a number of auto-generated files and folders that make up the structure of a Rails application. Most of the work in this tutorial will happen in the app folder, but here's a basic rundown on the function of each of the files and folders that Rails created by default:
In your terminal run rails s
and navigate to http://localhost:3000/
You should see the default landing page.