Copyright © tutorialspoint.com

Ruby on Rails 2.1.x - Directory Structure

previous next

Advertisements

When you use the rails' helper script to create your application, it creates the entire directory structure for your application. Rails knows where to find things it needs within this structure, so you don't have to tell it explicitly.

Here is a top level view of directory tree created by helper script at the time of an application creation. Except for minor changes between releases, every Rails project will have the same structure, with the same naming conventions. This consistency gives you a tremendous advantage; you can quickly move between Rails projects without relearning the project's organization.

To understand this directory structure let's use demo application created in installation chapter. This can be created using a simple helper command as follows:

C:\ruby\> rails -d mysql demo

Now go into demo application root directory as follows:

C:\ruby\> cd demo
C:\ruby\demo> dir

You will find a directory structure as follows:

demo/
..../app
......../controller
......../helpers
......../models
......../views
............../layouts
..../config
..../db
..../doc
..../lib
..../log
..../public
..../script
..../test
..../tmp
..../vendor
README
Rakefile

Now let's explain the purpose of each directory

Apart from these directories there will be two files available in demo directory.


previous next

Copyright © tutorialspoint.com