Ending a Rails 2 URL with an IP address causes routing error?

爱⌒轻易说出口 提交于 2019-12-03 00:40:54

Route globbing worked!

My route is now:

map.connect 'find/by/*query', :controller => "find", :action => "by"

This puts everything following /find/by/ into an Array, params[:query], one URL segment per array object. For the query /find/by/ip/1.2.3.4, this looks like:

["ip", "1.2.3.4"]

So I can just refer to params[:query][0] and params[:query][1].

If anyone has a better way of doing it, please post it!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!