我有根重定向到/welcome/about
正確的路線:root to: redirect('/welcome/about')
Rails的路徑助手不重寫URL在地址欄
當我要求localhost:3000/
從我的位置吧,它重定向到localhost:3000/welcome/about
預期。
但是,當我點擊使用路徑幫助程序(例如<%= link_to app_title, root_url %>
),進行的鏈接時,它不會更改地址欄中的網址。
其他一切按預期工作。 link_to呈現爲localhost:3000
,我收到了301與Location: http://localhost:3000/welcome/about
的迴應,並且內容是從正確的模板呈現的。我在Ubuntu 14.04上的Firefox和Chrome中驗證了這些結果。
任何人都可以解釋這種瀏覽器行爲?有沒有解決方法?
請試試這個:'<%= link_to app_title,'/'%>' – Rubyrider 2014-11-23 06:53:33
好的建議,但我嘗試過'root_path','root_url','/'和普通ol'http://本地主機:3000'。所有結果都一樣。 – Justin 2014-11-23 07:12:15