What Are All Those Folders?

The examples in this chapter have called programs in the script folder and modified files in the app and public folders. You might have noticed the large set of folders Rails created for an application. We’ll explore most of these in detail over the course of this book, but for now, here’s a quick guide to what’s there:

app

Where you build your application’s core. It includes subfolders for controllers, helpers, models, and views.

config

Hosts database configuration, URL routing rules, and the Rails environment structures for development, testing, and deployment.

db

Provides a home to scripts used to manage relational database tables.

doc

Collects documentation generated from Ruby code using RubyDoc. RubyDoc is a documentation generator for Ruby, much like JavaDoc. For a lot more information, see http://www.ruby-doc.org/.

lib

Holds code that doesn’t quite fit into the model, view, or controller classifications, typically code that’s shared by these components or plug-ins you install. The tasks subdirectory contains Rake tasks for your application.

log

Gathers log data—not just errors, but very rich information on requests, how they were processed, how long it took to process them, and session data from the request.

public

Contains things like stylesheets, images, JavaScript, and things like 404 Not Found error reporting pages.

script

The home for the prebuilt code you’ll be using to generate, run, and interact with large portions of your Rails application. ...

Get Learning Rails: Live Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.