Vlad Zloteanu
Vlad Zloteanu

Reputation: 8512

Rails router: Marking path as static (public)

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.

Upvotes: 0

Views: 332

Answers (1)

shingara
shingara

Reputation: 46914

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

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

Upvotes: 1

Related Questions