如何通过 Mongrel Web 服务器指定 Rails 中的文件路径

发布于 2024-08-31 23:20:50 字数 1154 浏览 2 评论 0原文

我有一个从 Rails 加载 swf 文件 flaMovie.swf 的请求。 swf 文件位于目录 /home/user1/railsproj/flash。

我在视图目录下有代码index.rhtml来显示.swf文件,

ID=flaMovie WIDTH=250 HEIGHT=250>

当我运行代码时,出现错误

ActionController::RoutingError (没有路由与 {:method=>:get} 匹配“/home/user1/railsproj/flash/flaMovie.swf”): /vendor/rails/actionpack/lib/action_controller/routing.rb:1441:in recognize_path' /vendor/rails/actionpack/lib/action_controller/routing.rb:1424:in识别' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:170:in handle_request' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:115:indispatch' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:126:in dispatch_cgi' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:9:in调度' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:在进程中' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:insynchronize'

我的rails项目位于/home/ user1/railsproj 和 Web 服务器是 Mongrel Web 服务器。

如何指定rhtml文件中的路径以便Mongrel服务器能够找到该文件?多谢,

I have a request to load a swf file, flaMovie.swf from rails. The swf file is located the directory /home/user1/railsproj/flash.

I have the code index.rhtml under view directory to show the .swf file,

ID=flaMovie WIDTH=250 HEIGHT=250>

When I ran the code, I got the error,

ActionController::RoutingError (No route matches "/home/user1/railsproj/flash/flaMovie.swf" with {:method=>:get}):
/vendor/rails/actionpack/lib/action_controller/routing.rb:1441:in recognize_path'
/vendor/rails/actionpack/lib/action_controller/routing.rb:1424:in
recognize'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:170:in handle_request'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:115:in
dispatch'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:126:in dispatch_cgi'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:9:in
dispatch'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:in process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in
synchronize'

My rails project is located in /home/user1/railsproj and the web server is Mongrel web server.

How to specify the path in the rhtml file so that Mongrel server is able to locate the file? Thanks a lot,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╰沐子 2024-09-07 23:20:51

将文件放入项目目录内的 public 目录中,其路径仅为 yourserver.com/flaMovie.swf

Put your file in public directory inside your project directory and path to it is just yourserver.com/flaMovie.swf.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文