How to route to a path/file in Rails?
I have a subdomain that need to point to a folder inside t开发者_高级运维he public folder.
I would be searching for something like this:
constraints DomainConstraint.new(CONFIG[:short_domain]) do
match '/:id' => '/path/to/folder/with/files/:id'
end
There is any build in way? Or a gem?
I'd use the routing as-is and use send_file, but there may well be a cleaner way that doesn't involve writing an (admittedly trivial) action. (Or handle it at a higher level, depending on what server you're using, I suppose.)
精彩评论