I have a small rails system I am building. Part of the code allow uploading files in to
RailsRoot/public/files folder
I am running this system is several places that have different domain and folder combinations.
cases:
1) domain1.com/folder_a # where folder_a is a symbolic link from Apache document root to the public folder of rails app 2) domain2.com/folder_b/public # where folder_b is the root of the rails app directly in the Apache document root 3) domain3.com # where I have set up a virtual host to point directly to the rails application root
If I have uploaded a file called test.doc, I would like to create a link from my rhtml template to the file that works where in which ever domain setup variation you see above.
How can I use link_to or something to create the following correct links for href= attribute in my link for each case above
for each case the correct Absolute links for file.doc should be:
1) domain1.com/folder_a/files/test.doc 2) domain2.com/folder_b/public/files/test.doc 3) domain3.com/files/test.doc
of course I can't use relative links
for in the case of domain setup 1)
link_to ("your file","files/test.doc") just goes to domain1.com.folder_a/controller/actions/files/test.doc link_to ("your file","/files/test.doc") just goes to domain1.com/files/ test.doc << back to domain base ignoring folder_a