Ruby on Rails中的路由区分大小写。似乎以前有人提出过这个问题,并且它被标记为无法解决。
Routes in Ruby on Rails are case sensitive. It seems someone brought this up before, and it has been labeled will not fix.
rails.lighthouseapp/projects/8994/tickets/393-routes-are-case-sensitive
这让我感到非常不幸,因为我并不认为自己的路线区分大小写会有任何上升的空间,而在下降的空间则可能造成混乱和我认为总体上缺乏波兰语。
That strikes me as unfortunate, as I don't really see any upside on my own application for routes to be case sensitive, while on the downside it creates a potential for confusion and a general appearance of lack of polish in my opinion.
使路线不区分大小写的最佳方法是什么?
What's the best way to make my routes case insensitive?
我在Google搜索中找到了这个提示:
I found this tip on a Google search:
map.connect "web_feeds/:action", :controller => 'web_feeds', :action => /[a-z_]+/i这很聪明,但是仍然留下了web_feeds部分网址区分大小写。但是,在没有手动输入wEb_feEds的每种可能组合的情况下,我看不出有任何类似的解决方法,但是出于多种原因,这显然是一个可怕的解决方案。
This is clever, but it still leaves the web_feeds portion of the url case sensitive. I don't see any similar way around this, however, without entering in each possible combination of wEb_feEds manually, but that is obviously a horrible solution for any number of reasons.
推荐答案我遇到了同样的问题,并使用中间件解决了-在这里看看:
I've just has the same problem, and solved it using middleware - have a look here:
gehling.dk/2010/02/how-to -make-rails-routing-case-insensitive /
注意:这仅适用于Rails 2.3 +
Note: This only applies for Rails 2.3+
- Carsten
更多推荐
Rails路线
发布评论