0
我users_controller有這些方法的Rails的form_tag後不工作
def follow_code
@user = current_user
end
def followsubmit
redirect_to root_path
end
我的路線文件有
match "follow_code" => "users#follow_code", :as => "follow_code"
match "follow_code" => 'users#followsubmit', :as => "follow_code", :via => 'post'
我follow_code.html.erb觀點有
<%= form_tag(follow_code_path, :method => 'post') do %>
<%= submit_tag("Submit") %>
<% end %>
然而,由於某些原因當我點擊我的視圖提交時,我從來沒有重定向到root_path,而是重新呈現follow_code視圖。
我在做什麼錯?謝謝。
後者工作。你先生,是一位紳士和學者。 – steve