I have a simple program that read all HTML files from a directory and returns parts of the content and the file names which are HREFs to those file. I build the HREF string dynamicaly as PATH_TO_DOC_ROOT + "file_name". My PATH_TO_DOC_ROOT = http://127.0.0.1:3000/docman/public/docs. So, the final link that I am interested in might look like this: http://127.0.0.1:3000/docman/public/docs/testfile1.html. However, when I click on the link, I get an error: -- No route for path: "docman/public/docs/testfile1" -- etc. I''ve looked at the routes.rb documentation, but still can''t figure out what needs to be done. How do I modify the routes.rb to make all files in /public/docs/ accessible from anywhere? Thanks for your help, eduard
Hi Eduard, On 21.3.2005, at 23:25, eduard wrote:> I have a simple program that read all HTML files from a directory and > returns parts of the content and the file names which are HREFs to > those file. > > I build the HREF string dynamicaly as PATH_TO_DOC_ROOT + "file_name". > My PATH_TO_DOC_ROOT = http://127.0.0.1:3000/docman/public/docs. So, > the final link that I am interested in might look like this: > http://127.0.0.1:3000/docman/public/docs/testfile1.html. > > However, when I click on the link, I get an error: -- No route for > path: "docman/public/docs/testfile1" -- etc. > > I''ve looked at the routes.rb documentation, but still can''t figure out > what needs to be done. How do I modify the routes.rb to make all > files in /public/docs/ accessible from anywhere?public is the document root of your rails application. So if your application is at http://127.0.0.1:3000/docman, the public/docs/file.html will be http://127.0.0.1:3000/docman/docs/file.html. It''s not a routes thing at all, I think. Static files are always given higher priority and the routes are kicking in only if there''s no static file in public corresponding to the address. So, in short, take public away from your uri. HTH, //jarkko> > Thanks for your help, > eduard > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 21.3.2005, at 23:42, eduard wrote:> Thanks jarkko, > > I tried that, but now I am getting this error: > > Unknown action > No action responded to docsAh, is docman a controller (and not the root of your rails app)? If so, you should take it away from the address, too. Let''s take this one more time. If http://url.com/ is the root of your rails app (the whole app), you can access any file in path/to/yourapp/public by just appending the file path after public to the address. So yourapp/public/file.html can be accessed through http://url.com/file.html> > Do I need to set up an action?Not for a static file. This is exactly the same as accessing your stylesheet: it''s located in public/stylesheets/style.css and you access it in your html source through http://url.com/stylesheets/style.css. The public folder is completely equal to a normal public_html folder in a normal unix setup. //jarkko> > Thanks again for you help. > eduard > > > On Mon, 21 Mar 2005 23:31:59 +0200, Jarkko Laine <jarkko-k1O+Gnc6WpmsTnJN9+BGXg@public.gmane.org> > wrote: >> Hi Eduard, >> >> On 21.3.2005, at 23:25, eduard wrote: >> >>> I have a simple program that read all HTML files from a directory and >>> returns parts of the content and the file names which are HREFs to >>> those file. >>> >>> I build the HREF string dynamicaly as PATH_TO_DOC_ROOT + "file_name". >>> My PATH_TO_DOC_ROOT = http://127.0.0.1:3000/docman/public/docs. So, >>> the final link that I am interested in might look like this: >>> http://127.0.0.1:3000/docman/public/docs/testfile1.html. >>> >>> However, when I click on the link, I get an error: -- No route for >>> path: "docman/public/docs/testfile1" -- etc. >>> >>> I''ve looked at the routes.rb documentation, but still can''t figure >>> out >>> what needs to be done. How do I modify the routes.rb to make all >>> files in /public/docs/ accessible from anywhere? >> >> public is the document root of your rails application. So if your >> application is at http://127.0.0.1:3000/docman, the >> public/docs/file.html will be >> http://127.0.0.1:3000/docman/docs/file.html. It''s not a routes thing >> at >> all, I think. Static files are always given higher priority and the >> routes are kicking in only if there''s no static file in public >> corresponding to the address. >> >> So, in short, take public away from your uri. >> >> HTH, >> //jarkko >> >>> >>> Thanks for your help, >>> eduard >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >> -- >> Jarkko Laine >> http://jlaine.net >> http://odesign.fi >> >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> >> > > > -- > Eduard Sherstnev > TRIResults.com >-- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
That worked! Thank you, Eduard On Mon, 21 Mar 2005 23:55:44 +0200, Jarkko Laine <jarkko-k1O+Gnc6WpmsTnJN9+BGXg@public.gmane.org> wrote:> > On 21.3.2005, at 23:42, eduard wrote: > > > Thanks jarkko, > > > > I tried that, but now I am getting this error: > > > > Unknown action > > No action responded to docs > > Ah, is docman a controller (and not the root of your rails app)? If so, > you should take it away from the address, too. > > Let''s take this one more time. If http://url.com/ is the root of your > rails app (the whole app), you can access any file in > path/to/yourapp/public by just appending the file path after public to > the address. So yourapp/public/file.html can be accessed through > http://url.com/file.html > > > > > Do I need to set up an action? > > Not for a static file. This is exactly the same as accessing your > stylesheet: it''s located in public/stylesheets/style.css and you access > it in your html source through http://url.com/stylesheets/style.css. > > The public folder is completely equal to a normal public_html folder in > a normal unix setup. > > //jarkko > > > > > Thanks again for you help. > > eduard > > > > > > On Mon, 21 Mar 2005 23:31:59 +0200, Jarkko Laine <jarkko-k1O+Gnc6WpmsTnJN9+BGXg@public.gmane.org> > > wrote: > >> Hi Eduard, > >> > >> On 21.3.2005, at 23:25, eduard wrote: > >> > >>> I have a simple program that read all HTML files from a directory and > >>> returns parts of the content and the file names which are HREFs to > >>> those file. > >>> > >>> I build the HREF string dynamicaly as PATH_TO_DOC_ROOT + "file_name". > >>> My PATH_TO_DOC_ROOT = http://127.0.0.1:3000/docman/public/docs. So, > >>> the final link that I am interested in might look like this: > >>> http://127.0.0.1:3000/docman/public/docs/testfile1.html. > >>> > >>> However, when I click on the link, I get an error: -- No route for > >>> path: "docman/public/docs/testfile1" -- etc. > >>> > >>> I''ve looked at the routes.rb documentation, but still can''t figure > >>> out > >>> what needs to be done. How do I modify the routes.rb to make all > >>> files in /public/docs/ accessible from anywhere? > >> > >> public is the document root of your rails application. So if your > >> application is at http://127.0.0.1:3000/docman, the > >> public/docs/file.html will be > >> http://127.0.0.1:3000/docman/docs/file.html. It''s not a routes thing > >> at > >> all, I think. Static files are always given higher priority and the > >> routes are kicking in only if there''s no static file in public > >> corresponding to the address. > >> > >> So, in short, take public away from your uri. > >> > >> HTH, > >> //jarkko > >> > >>> > >>> Thanks for your help, > >>> eduard > >>> _______________________________________________ > >>> Rails mailing list > >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >>> http://lists.rubyonrails.org/mailman/listinfo/rails > >>> > >> -- > >> Jarkko Laine > >> http://jlaine.net > >> http://odesign.fi > >> > >> > >> _______________________________________________ > >> Rails mailing list > >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > >> > >> > >> > > > > > > -- > > Eduard Sherstnev > > TRIResults.com > > > -- > Jarkko Laine > http://jlaine.net > http://odesign.fi > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >-- Eduard Sherstnev TRIResults.com