Ruby on Rails - Directory Structure


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

Here is a top-level view of a directory tree created by the helper script at the time of 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 the demo application created in the Installation chapter. It can be created using a simple helper command rails demo.

Now, go into the demo application root directory as follows −

tp> cd demo
demo> dir

You will find a directory structure in Windows as follows −

Directory

Now let's explain the purpose of each directory

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