这是rails表单帮助代码,
<%= form_tag({ :action => "create"}, :method => "POST", :id=>"login") do -%>
<h1>Log In</h1>
<fieldset id="inputs">
<%= text_field :username, :placeholder => 'Username', :autofocus=>true%>
<%= password_field_tag :userpass, params[:userpass], placeholder: 'Password', id:'password'%>
</fieldset>
<fieldset id="actions">
<input type="submit" id="submit" value="Log in">
<a href="/registration/index">Register</a>
</fieldset>
<% end %>
这是我想要的html代码,
<form action="/login/create" method="post" id="login" >
<h1>LogIn</h1>
<fieldset id="inputs">
<input id="username" type="text" name ="username" placeholder="Username" autofocus required>
<input id="password" type="password" name="userpass" placeholder="Password" required>
</fieldset>
<fieldset id="actions">
<input type="submit" id="submit" value="Log in" name="apply">
<a href="/registration/index">Register</a>
</fieldset>
</form>
但是,如果我运行 rails 代码,它会生成这样的代码,
<input id="username_{:placeholder=>"Username", :autofocus=>true}" name="username[{:placeholder=>"Username", :autofocus=>true}]" size="30" type="text">
有人知道问题是什么吗?