Re: Routes - Preventing a Match

Jeremy Olliver
Sat, 06 Jun 2009 12:08:46 -0000

You don''t need to change anything in your routes file for that to
work.

Any static files that exist in the public folder (eg all your images/
js/css or public/static/test1.html) will be served as static files.
Don''t forget that the url to browse to these files is /static/
test1.html and not /public/static/test1.html since it is the public
folder and not the rails root that is the webserver root directory.

Cheers,
Jeremy

On Jun 6, 6:02 pm, djolley
<ddjol...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> > If you are wanting Rails to stop processing, what should it do?
> > What are you really wanting to achieve?
>
> I just want the URL to be served-up as a static page.
>
> > The normal use case is that static files are not served by Rails but
> > in that circumstance, another server would serve them *before* Rails.
>
> I don''t understand that.  As configured out-of-the-box Rails
serves
> the static page public/index.html as a home page.  Although I have
> never done it, I assume that I could simply modify that static page
> and use it as the home page for a site.  I just want to accomplish
> essentially the same thing.  I want to be able to have a few
> static .html pages in public/static, e.g. public/static/test1.html.
> In the case of this example, I don''t want
''static'' to map to a
> controller and ''test1'' map to an action.  It would be my
understanding
> that that is what would happen if there were some sort of beginning
> instruction in the routes.rb file to the effect that if a URL begins
> with /static there should be no further processing thus the standard
> mappings to a controller and an action would just not be invoked WRT
> that particular URL.
>
> Anyway, I didn''t mean to get carried away here.  I believed that I
was
> just missing some minor point and that someone would square me away
> with ease.  Apparently the point isn''t as trivial as I had
thought.
>
> Thanks for the input.
>
>           ... doug