Ruby on Rails

Create Ruby on Rails Project from Scratch, a beginner's guide

Ruby On Rails

Learn Ruby on Rails


This entry is part 1 of 4 in the series Learning Ruby on Rails From Scretch

In this tutorial we will create Ruby on Rails Project. I hope you have ruby on rails installed on your machine, if not please check our previous tutorial on Installing Ruby on Rails. Lets see how we can create ruby on rails project.

First Create a directory to store all your rails projects. You can name it anything you want but i am using “Sites” folder to store all my rails project. Open Terminal on MAC or Command Prompt on Windows. I’m using MAC for rails project. Now navigate to Sites directory, which we just created. you dont have to create a directory for project, rails will create one for us.

Create Ruby on Rails Project

Type following command on terminal.


if you wnat to use mysql as a database for your rails project. we can preconfigure rails project at create ruby on rails project command by passing an argument like below:

We can also change configuration of database for rails project but above command will preconfigure that for us. By default rails uses SQLite. So make sure we are using -d mysql option as long as we use mysql database. when we issue one of above command it will create ruby on rails project by creating a folder named first_project. If you check that directory you will find bunch of files and directories that is created by rails command.

create ruby on rails project

If we delete first_project directory, our rails application will be gone.

Accessing Project

Navigate to project directory, for me its first_project and i am already on that directory. In order to see our project we have to launch web server. Now we are not using apache but we are using one which comes with rails which is WEBrick and to launch WEBrick type following command on terminal:

As soon as you issue above command you will see some messages like below:

create ruby on rails project rails startup

Note: To stop rails server command is given to us in startup server screen which is Ctrl-C. so don’t close terminal. just leave it open and minimise it.

Now as you can see in those messages our WEBrick is running on port 3000 but how do we get there. Yes i guess you are right! Browser is the key to access localhost’s 3000 port. open your favourite browser and type url http://localhost:3000 and a rails screen will be displayed like below:

create ruby on rails browser

This is the rails project start up page. this shows our rails server is running perfectly. if we stop rails server and refresh page, it won’t show this page and gives error. In next tutorial we will create our first page of rails project.

I hope you like this tutorial.for more updates visit & like our FB Page.

Series NavigationInstalling Ruby on Rails on Mac OSX Platform >>

Bookmark Link using: bookmark at folkd