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 S. 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

On Mon, Jan 11, 2010 at 10:01 PM, Newb N. [email protected]
wrote:

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

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 -

On Jan 11, 11:41Â pm, Newb N. [email protected] wrote:

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.

Posted viahttp://www.ruby-forum.com/.

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.

Curtis S. wrote:

On Mon, Jan 11, 2010 at 10:01 PM, Newb N. [email protected]
wrote:
Thank u all for the reply.

<%= link_to image_tag(“backup_configure.png”,:title => “view
chat”),{:action => “open_live_file”,:file_path => @file_path},{:target
=> ‘_new’} %>

def open_live_file
#--------------
@backup = ChathistoryBackup.find(:first)

unless @backup.nil? and params[:file_path].nil?

  file_path = params[:file_path]

  if File.exists?("#{file_path}")

    render :file => "#{file_path}", :layout => false

  end

end

end

when clicking on the above link it opens the html file on a browser
window but it has not shown the images in the html file.

In my public folder

public/Server_exe/ChatHistory/2010-01-10/2010-01-10\1~Vs~2\1~Vs~2.html
=> the html file is located in this path
for the above html file images are in the following path

public/Server_exe/ChatHistory/2010-01-10/1~Vs~2/ScreenCapture/2120100109101048121.jpg
=> this image is shown in the html file

when rendering this file why the images are not shown even its all in
public folder

Thank u for taking time to reply

Sorry for annoying.

render :file => “#{file_path}”, :layout => false

the html file contains images with it
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 ?

Thanks in advance

On Jan 12, 12:23Â am, Newb N. [email protected] wrote:

for the above html file images are in the following path

public/Server_exe/ChatHistory/2010-01-10/1~Vs~2/ScreenCapture/2120100109101 048121.jpg
=> this image is shown in the html file

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.”

On Jan 12, 12:10Â am, pharrington [email protected] wrote:

Posted viahttp://www.ruby-forum.com/.

-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.

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.

On Mon, Jan 11, 2010 at 9:32 PM, Newb N. [email protected] wrote:

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.

2010/1/12 Newb N. [email protected]:

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs