我建了一个登录页面【index.html.erb】:
<%= form_tag do %>
<fieldset>
<legend>Please Input Details</legend>
<div>
<label for="username">username:</label>
<%= text_field_tag :username, params[:username] %>
</div>
<div>
<label for="password">password:</label>
<%= password_field_tag :password, params[:password] %>
</div>
<div>
<%= submit_tag "Login" %>
</div>
</fieldset>
<% end %>
用以下后台代码进行登录验证【welcome_controller.erb】:
class WelcomeController < ApplicationController
def index
if "Vincent" == params[:username] && "123456" == params[:password]
redirect_to(welcome_login_path)
else
redirect_to(welcome_logout_path)
end
end
def login
end
def logout
end
end
结果只会跳至http://localhost:3000/welcome/logout,请问我的代码哪里出错了?