Forum: Ruby on Rails Access folders outside RAILS_ROOT

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Shruthi V. (Guest)
on 2007-06-28 13:38
How does one make available folders outside the rails root dir? For e.g
I want to create a folder of html pages in C:\. How do I make this
accessible to users of my Rails server?
Mikel (Guest)
on 2007-06-28 15:36
(Received via mailing list)
Dear Shruthi,

This is basically a bad idea from a security viewpoint.  It is
possible from Rails, but it is not a good idea and so, like all not so
good ideas, Rails makes it harder for you.

"The usual is easy, the uncommon is possible... but not always easy".

Doing this is actually not so hard, and is actually a web server
issue, not a rails issue.  Rails handles the rendering of your rails
pages out of the RAILS_ROOT/public directory.

Your BEST bet is to move those files out of C and put them somewhere
that your normal webserver can get to them.  But NOT in the root

If you put it in the root directory, you open up the ability for
people to go

You get the idea

So you need to really go into your web server and find out what you
need to do, it is not so much rails.

Unless you are trying to get rails to send files to the users using
send_file or something in which case, just type the path in the
send_file param.  Start it with a / and you will get the root dir.


Shruthi V. (Guest)
on 2007-06-28 16:40
Thanks a lot for the info, Mikel. I think I worded my question wrongly.
I just want to render HTML pages stored in a folder which is not under
RAILS_ROOT/public directory, but is elsewhere, like C:\abcd\. So all I
want to do is switch the context from RAILS_ROOT to the other folder, to
display the static HTML pages. I dont think there's any security threat
in this case. How exactly do I do this?
This topic is locked and can not be replied to.