[英]How would the following change using the bootstrap_form_for gem?
##我不確定如何在下面的舊代碼片段中重寫:action =>標記以使用boostrap_form_for上下文。 有人可以幫忙嗎?
<%= form_tag(:action => 'attempt_login') do %>
<%= error_messages_for(@user) %>
<table>
<tr>
<th>email</th>
<td><%= email_field_tag(:email) %></td>
</tr>
<tr>
<th>password</th>
<td><%= password_field_tag(:password) %></td>
</tr>
</table>
<div class="frm-button">
<td><%= submit_tag("login") %></td>
</div>
<% end %>
請使用url: ''
。 如果您在找到正確的網址時遇到問題,請運行rake routes
並在其中搜索操作。
您應該在routes.rb
包含以下內容:
match '/attempt_login', to: 'login_controller#attempt_login', via: :post
然后編輯您的表單:
<%= bootstrap_form_for(url: '/attempt_login', method: :post) do |f| %>
...
<% end %>
希望能有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.