Create a new application


To create a new application, you simply have to type in your terminal rails new name_of_your_project.

To create the demo application, I will first make a project folder on my Desktop, go to that folder, and run rails new rgdemo:

$ mkdir ~/Desktop/rails_girls_project
$ cd ~/Desktop/rails_girls_project
$ rails new rgdemo

This is what it looks like in my terminal:

  • the start...

  • and the successful completion of the rails new command

I see now that this command created a new folder, rgdemo, with a complex hierarchy of folder and files inside. To explore them, I will go to that folder and open it in the file explorer.

$ cd rgdemo
$ open

We will be giving insights on how to understand this file hierarchy in the next section. Now I want to see my application in action!

In the terminal, type:

$ rails server

Now open your favorite browser and go type localhost:3000 in the address bar. You should see a greeting from Rails!

Congrats! Now you're running your first application.

To stop the server in order to reuse the terminal, use Ctrl+C. Refreshing the localhost:3000 page in your browser will show that the server is no longer running.

results matching ""

    No results matching ""