开发者

How to route to a path/file in Rails?

开发者 https://www.devze.com 2023-04-11 00:57 出处:网络
I have a subdomain that need to point to a folder inside t开发者_高级运维he public folder. I would be searching for something like this:

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

精彩评论

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