When to use it
If you are running your app completely in a subfolder of your domain.
For example, if you want to run your blog as www.domain.com/blog and have it be a totally different Rails app than www.domain.com.
Also note in this scenario you would need the below code in your www.domain.com/.htaccess just under where it says 'use the following rewrite rules so that Apache won't rewrite certain requests':
RewriteCond %{REQUEST_URI} ^/blog.*
RewriteRule .* - [L]
and in your environment.rb (see below where to put it) you'll need the good ol': ActionController::AbstractRequest.relative_url_root = "/blog"
other than this sort of www.domain.com/blog scenario, you shouldn't use it. Why to use it
Essentially, it tells Rails to tack on an extra '/blog' to every URL it writes. Routes in Rails are awesome, BTW. This way, it will know to sent requests into your 'blog' folder instead of into your main app.
Where to put it
You'll want to put it at the VERY bottom of your environment.rb file after the:
# Include your application configuration below
If you put it anywhere else, your app will likely run into routing troubles. So hopefully that clears things up a bit. Your app will load if the relative_url_root is there and it shouldn't be, but you won't be able to browse around to different controllers. So if (for example) your images and CSS files don't load into your app correctly, Rails is telling the app to look in something like www.domain.com/blog/images/dude.jpg rather than www.domain.com/images/dude.jpg
Feel free to post below anytime if you have questions or comments.
Cheers,
~William