Q: What is the use of RAILS_ROOT variable and where it is defined?

When we START an application of ROR then we are required to tell the server (Webrick/Apache-passenger ) about the main directory of the project i.e the directory with the same name of the application. This main directory is the parent(root) directory of all other files and sub-directories of the project. RAILS_ROOT is the variable which tells the server about the parent directory.

RAILS_ROOT variable is defined in boot.rb located at my-app/config/boot.rb

By default it is understood by the server but if you install any plug_in like attachment_fu then you need to specify

inside boot.rb

RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)

By doing this errors of RAILS_ROOT not defined will be resolved.

Advertisements

2 thoughts on “Q: What is the use of RAILS_ROOT variable and where it is defined?

Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: