rails: url_for() and capitalization
on moving a current site from rails 1.1.6 (it runs the theme engine, so i had to fix that before moving it over), i found another weird thing in 1.2.3…
in the past, when i wanted to point to a static file, i would use something like:
url_for(:controller => ‘/audio/Mp3/FiLeNaMe.Mp3′)
this is just an example, and i don’t use such crazy camel casing, but that’s not to say that your users won’t. anyway, this worked fine before the upgrade, and i had no problems. after the upgrade, i quickly found that this no longer worked..
from the console, here’s what i would get:
?> app.url_for(:controller => ‘/audio/Mp3/FiLeNaMe.Mp3′) => “http://www.example.com/audio/mp3/filename.mp3″
this is not good..
i dug around the source code, and even sent in a ticket to the rails trac.. i got an answer back, but i am still not sure how to flesh out what this all means.. soooo..
to solve this problem, i ended up making a custom route for the audio portion of the site..
this isn’t exactly how i would want to do things, as writing custom routes for static files seems a little backwards, but i am gonna run with it for a bit and see what happens.