我試圖把一些光滑的按鈕放在我的rails應用程序中作爲鏈接。但是,我嘗試這樣做時遇到了一個奇怪的問題。我已經嘗試添加一個鏈接按鈕如下:Button_to鏈接導致路由錯誤
<%= button_to("New", :action => "new", :controller => "registrations") %>
這將導致一個不錯的新按鈕,我的用戶引導至sign_up頁面。
這裏的地方會很奇怪:當我點擊我排到http://localhost:3000/users/sign_up
按鈕,收到以下錯誤:
No route matches [POST] "https://stackoverflow.com/users/sign_up"
但是這根本不是真的。事實上,我可以突出顯示導致我出現此錯誤的網址,將其複製並粘貼到新標籤中,並加載正常。
必須絕對清楚,這裏是從rake routes
路徑:
new_user_registration GET /users/sign_up(.:format) registrations#new
什麼可能是怎麼回事呢?
任何想法表示讚賞。
很好,謝謝! – neanderslob 2014-12-19 08:32:18