On Thursday 21 April 2005 04:24 pm, joshua wrote:> Is it possible to fake a file extension in routes?
> I would like to do something like...
> map.connect
'':username/audio/:filename''+''.mp3'',
> :controller => ''files'', :action =>
''download''
The following route would ensure the :filename portion of the url ends in
''.mp3'' before invoking the download action on the files
controller:
map.connect '':username/audio/:filename'',
:controller => ''files'', :action =>
''download'',
:requirements => {:filename => /\.mp3$/}
However, I believe, it would require the :filename parameter always include
the .mp3 extension when using url_for based methods eg:
url_for :controller => ''files'', :action =>
''download'', :username => ''johnson'',
:filename => ''mymusic.mp3''
Also the @params[''filename''] value would end in .mp3 using
this method.
--
Micah Alles micah-T1YOP9nF7vWQ0r5V5wSIsA@public.gmane.org
616-776-6020
Software Journeyman Atomic Object LLC
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails