开发者

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.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜