ruby on rails - routes.rb - match file extension when multiple periods exist in filename

前端 未结 3 1843
后悔当初
后悔当初 2021-01-14 20:37

I have created a route plus controller for doing dynamic css in ruby on rails as per the instructions here:

http://www.misuse.org/science/2006/09/26/dynamic-css-in-r

3条回答
  •  野的像风
    2021-01-14 20:53

    Use a regex to match the filename?

    map.connect 'rcss/:rcssfile',
      :controller => 'rcss',
      :action => 'rcss',
      :requirements => {:rcssfile => /.+\.rcss/ }
    

    This would match (anything).rcss - you could adjust the regex for various suffixes.

提交回复
热议问题