views:

50

answers:

1

Is there any way (middleware, etc) to tell the rails router that any route beginning with /photos should be considered as static data and should only be served from the /public/photos folder?

What i mean is that if the resource is not found, a 404 should be returned directly, without loading all rails stack.

This is for my dev env (single threaded mongrel), I don't want to use a front-end server.

+1  A: 

You can define a Rack::Middleware Rack::Static (http://rack.rubyforge.org/doc/classes/Rack/Static.html)

use Rack::Static, :urls => ["/photo"]
shingara