HOW TO MAP OUTSIDE THE RAILS DIRECTORY

Wishes to all,   Is there any method to display the HTML file with images outside the rails folder.

Kindly let me know your views on my above question!

Thanks for any helps.

well i wouldn’t recommend it.

You may be able to get FollowSymLinks in apache and make a symlink if you are on unix.

Probably what you want is to set up apache with a rewrite rule to pull from a different vhost.

those are both fairly complicated.

Curtis Schofield wrote:

well i wouldn't recommend it.

You may be able to get FollowSymLinks in apache and make a symlink if you are on unix.

Probably what you want is to set up apache with a rewrite rule to pull from a different vhost.

those are both fairly complicated.

thanks for the reply. cant rails open a html file which is in the local machine? location would be D:/temp

What exactly are you trying to do?

As is, this question doesn't quite make sense... just drop the html pages and images and whatever other resources in /public and be done with it.

If I were to *guess*, mayhaps you have static content that you only want accessible by users authenticated through your app? Something like this may work (completely off the top of my head):

-setup the appropriate catchall route, mapping to some action in an AuthenticatedResource controller or somesuch ish -require the user to be logged in -make sure the requested file exists in whatever directory, and if so send_file as necessary (also it'd really really help to use something like mod-xsendfile)

Of course this may not at all be what you're actually trying to do, so let us know what your end goal is.

You can read and write files in ruby - from into /tmp - but it is generally not too good idea to spread things around to much -

OK I just read your other thread, and I'm pasting the contents here (multiple threads for the sammmmme exact issue is a terrible way to get your problem resolved):

"Dear Friends, I use render :file method to display html file which has images in it . The render file method not displays a HTML file with images that's exists inside public folder. Both my HTML files and images refereed are in the public folder only.    Question 1: how to view that HTML file with images in it    Question 2: why render file method is not showing the images in the HTML                file and simply shows the HTML content without images Thanks for any helps! "

OK. The resources are already in /public. How every Rails app setup works is that files in /public are served directly by the webserver, bypassing your Rails app. So if you have HTML pages in /public, Rails does not need to get involved in their serving at all. EXAMPLE: your site runs from http://localhost. you have a file "d:\railsapp\public \static_content\ish.html." This file can be view by navigating to http://localhost/static_content/ish.html in the web browser.

Does this help? If not, *what exactly are you trying to accomplish.* I don't care how you think you can accomplish it, just say what the end result should be.

Curtis Schofield wrote:

Sorry for annoying.

This image path is not correct. As I said:

"EXAMPLE: your site runs from http://localhost. you have a file "d:\railsapp\public \static_content\ish.html." This file can be view by navigating to http://localhost/static_content/ish.html in the web browser."

the html file contains images with it

No, it doesn't -- it contains tags with URLs of images.

when i render the above html file from the public folder it shows the file in a browser window without the images displayed.

why it is so?why it cant display the images ?

Because the URLs in the rendered HTML don't match the URLs of the actual image files on the server.

If, instead of reposting the same question over and over, you actually *looked* at the rendered HTML and compared those URLs to what is being provided by your server, you might find the answer.

If you wish to open a file on the local machine (where browser and rails are running on the same PC) then I suppose you can use the file:// syntax. Note that this will not work if you access the rails app from a different machine. Otherwise you can access files anywhere that your web server can pick them up from, just put the full uri of the file.

Colin