看板 Ruby 關於我們 聯絡資訊
Ruby 完全不熟 來請教各位大大 先謝謝各位了 就是假如我有設一條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) 感謝各位~ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.130.182.55 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Ruby/M.1569993461.A.060.html
tonytonyjan: routes 後面加上 `:format => false` 10/02 22:39
tonytonyjan: 或寫在 `scope(format: false){ }` block 裡面 10/02 22:40
q26766: 樓上大神 10/03 00:18
Kayuo: 感謝大神的回覆 但試了幾次還是無效果 不知道是不是設錯了 10/07 09:51
Kayuo: get "test/index" 10/07 09:52
Kayuo: match ':controller(/:action(/:id))(.:format)', :control 10/07 09:53
Kayuo: ler => /test\/[^\/]+/ 10/07 09:53
Kayuo: 看前人的設定是這樣 我在get "test/index"後面加或是match 10/07 09:54
Kayuo: 後面增加 都還是會有一樣的問題 10/07 09:55
Phenomenon: match ':controller(/:action(/:id))(.:format)', :c 10/07 11:47
Phenomenon: ontrol 把(.:format) 拿掉就好 10/07 11:47
Kayuo: 回P大 小弟把(.:format)拿掉以後還是一樣會連過去 10/08 16:14
Phenomenon: Format 拿掉後面有加 format: false 嗎? 10/09 13:44