views:

174

answers:

1

hi, 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:inrecognize' /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:indispatch' /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:insynchronize'

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,

A: 

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

klew
Thanks,Klew. It worked. Another question, if my files are located in the directory other than /public?What is the suggested approach to access those files?
erwin
They should be placed in public directory. I don't know about any other approach. Of course you can write controller and serve files through it but it is not good for static files, images, flash, etc. If it worked, you can mark this answer as "accepted".
klew