我不斷收到這個錯誤,當我嘗試並查看我的註冊用戶頁面軌,傾斜視圖註冊用戶頁面
的Firefox已檢測到服務器 被重定向此 地址的請求的方式,將從來沒有 完整。
def register
#User registration form
@user = User.new(params[:user])
if @user.save
flash[:notice] = "Account Created Successfully"
redirect_to(:action=>'menu')
else
flash[:notice] = "Please fill in all fields"
redirect_to(:action=>'register')
end
end
<div class="user new">
<h2>Create User</h2>
<%= form_for(:user, :url => {:action => 'register'}) do |f| %>
<table summary="User form fields">
<tr>
<th>First Name</th>
<td><%= f.text_field(:first_name) %></td>
</tr>
<tr>
<tr>
<th>Last Name</th>
<td><%= f.text_field(:last_name) %></td>
</tr>
<tr>
<th>UserName</th>
<td><%= f.text_field(:user_name) %></td>
</tr>
<tr>
<th>Password</th>
<td><%= f.text_field(:password) %></td>
</tr>
<tr>
<tr>
<th>Email</th>
<td><%= f.text_field(:email) %></td>
</tr>
<tr>
<tr>
<th>Telephone</th>
<td><%= f.text_field(:telephone) %></td>
</tr>
<tr>
<td> </td>
<td><%= submit_tag("Register") %></td>
</tr>
</table>
<% end %>
</div>
另外,equals('<%=')在'form_for'中不需要。只要做'<%'。 – Todd 2010-11-17 00:27:59