Digital Pardoe
2008-Feb-23 20:07 UTC
Routing An Old URL For A File To A Controller / Action
Hi, Currently users to my website download files from the following structure of URL: http://thewebsitefortest.com/downloads/folder/filename.dmg I would like to make it so that when the user navigates to the above URL they are redirected to a controller / action. There are however about 50 files for download so I don''t want a route for each one. I have tried creating a controller called downloads but the file is still accessed. I have also tried the following in routes.rb; map.connect ''downloads/:folder/:filename'', :controller => ''controller_name'', :action => ''index'' However this didn''t work, the main reason for doing this is that I now want to keep track of downloads from my website using google analytics so I need a page to load in between, but, I don''t want to break all the other sites that link directly to my downloads. I have also moved the downloads into another folder, so Rails must evaluate the route but I just get no route matches errors from the above. Thanks in advance, Alex -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---