[英]login form on navigation bar in rails
我已經為導航欄創建了以下表單:
<form action="/sessions" method="post" class="well form-inline">
<input id="user_email" name="user[email]" type="text" placeholder="Email">
<input id="user_password" name="user[password]" type="password" placeholder="Password">
<label class="checkbox">
<input type="checkbox"> Remember me
</label>
<button name="commit" type="submit" class="btn">Sign in</button>
</form>
該表單位於導航欄上,我必須告訴它進入sessions controller
並使用create
動作。 怎么做? 我搜索了幾天!
......
這是erb嗎? 如果是這樣,則應使用form_for並簡單地為其指定session對象。 看這里 。
您可以這樣做:
<% form_tag(:controller => "/search", :action => "create", :method => "post") do %>
# The input fields and other fields
# <%= input_tag(..params..) %> and so on
<% end %>
如此處所述: Rails指南:表單助手中的多個哈希
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.