Other Pages

Getting Started

Screenshot of a Ruby on Rails default home page

Goals

  • Create Your New Application

  • Let's get started! By the end of this step, we'll have a brand-spankin'-new (empty) Rails app.

Steps

If you have any problems, call over a TA.

Step 1

Type this in the terminal:
rails new .

rails new creates a new Rails project in the specified folder.

In this case we told it to create a new project in the current folder, denoted by the "." at the end.

This will print a lot of stuff to the screen and can take a while to finish.

Step 2

Type this in the terminal:
ls

ls stands for "list (stuff)."

Step 3

Let's look at the structure of the whole project.

You can see the project directory. This is convenient when you're going to edit several files and want to navigate quickly.

You can see that rails new created a lot directories and files. The ones we want to focus on today are:

File/Folder Purpose
app/ Contains the controllers, models, and views for your application. You will do most of your work here.
config/ Configure your application's runtime rules, routes, database, and more.
db/ Shows your current database schema, as well as the database migrations.
public/ The only folder seen to the world as-is. If you put files in here, they will be served directly without any processing by Rails.
app/assets/ This is where your images, JavaScript, stylesheets (CSS), and other static files should go. Modern Rails apps use something called the Assets Pipeline, which combines all the JavaScript and CSS files in this directory into a single file for speediness.

There is a lot more that rails new created. Probably enough to fill a book, so we're going to ignore them for now.

Next Step: