Correct routing to handle static file requests

All,

I included these two routes in my routes.rb file so that any requests
for contents of the public/javascripts and public/stylesheets
directories wouldn’t be screwed up.

Will the routes below reliably pass these requests through without
attempting to interpret them into Rails requests?

Thanks,
Wes

=================

map.connect ‘javascripts/*stuff’
map.connect ‘stylesheets/*stuff’

On Sep 6, 2006, at 12:57 PM, Wes G. wrote:

I included these two routes in my routes.rb file so that any requests
for contents of the public/javascripts and public/stylesheets
directories wouldn’t be screwed up.

Will the routes below reliably pass these requests through without
attempting to interpret them into Rails requests?

Have you tried your app without them? In most (all?) environments
requests will only be passed to rails if there isn’t a static file
matching the URL.

James.


James S. : Freelance Web D.
Work : http://jystewart.net
Play : http://james.anthropiccollective.org

Wes G. <rails-mailing-list@…> writes:

I included these two routes in my routes.rb file so that any requests
for contents of the public/javascripts and public/stylesheets
directories wouldn’t be screwed up.

map.connect ‘javascripts/*stuff’
map.connect ‘stylesheets/*stuff’

The apache .htaccess RewriteRule will only pass a request to Rails if
the file
doesn’t exist. So you don’t need that line at all - if it’s ever used
then
you’ve got a stylesheet or javascript tag wrong

Two things:

  1. I’m using WEBrick (and I’m starting to see that maybe I should
    abandon WEBrick despite it’s convenience - for other reasons).

  2. The requests are not just for the static file names, they are being
    made with fake query parameters at runtime, in order to ensure that
    changes are picked up - I think this is why the rule is necessary.

Wes

  1. I’m using WEBrick (and I’m starting to see that maybe I should
    abandon WEBrick despite it’s convenience - for other reasons).

I moved to mongrel from WEBrick and find it much more responsive and I
don’t get any issues with reloading of files like I did with WEBrick.
It’s just as convenient as WEBrick as well, now that ./script/server
will run mongrel - not sure what version of rails that came in with
though.

Oooh I didn’t know you could run mongrel using script/server - will look
into it.

Thanks!