楼主:
Kayuo (郭郭)
2019-10-02 13:17:39Ruby 完全不熟 来请教各位大大
先谢谢各位了
就是假如我有设一条routes
网址是 localhost:3000/index
这样子导向我期望的页面OK了
但是如果是 localhost:3000/index.ewgwgw
就是index.后面乱加什么东西也一样会导至该页面
该如何设定 只能符合index这字样才转到该页面
Rails版本是 3.2.9
Ruby版本是 ruby 1.9.3p484 (2013-11-22 revision 43786)
感谢各位~
routes 后面加上 `:format => false`或写在 `scope(format: false){ }` block 里面
作者:
q26766 (cancan)
2019-10-03 00:18:00楼上大神
楼主:
Kayuo (郭郭)
2019-10-07 09:51:00感谢大神的回复 但试了几次还是无效果 不知道是不是设错了get "test/index"match ':controller(/:action(/:id))(.:format)', :controller => /test\/[^\/]+/看前人的设定是这样 我在get "test/index"后面加或是match后面增加 都还是会有一样的问题
match ':controller(/:action(/:id))(.:format)', :control 把(.:format) 拿掉就好
楼主:
Kayuo (郭郭)
2019-10-08 16:14:00回P大 小弟把(.:format)拿掉以后还是一样会连过去
Format 拿掉后面有加 format: false 吗?