我有一个带有check_box
方法的表单,当我提交表单时,它不会保存给用户。(我在控制台中使用User.all检查)它是一个单独的表单而不是符号形式,我不知道这是否有必要,但我正在使用设计。
Parameters: {"utf8"=>"✓", "authenticity_token"=>"LPplw/AwLhpDNt4xz7+VUAFr2BefWNapVDn3w4sroUg6jPUSK1kG9Pv3+cepeY2Qw50aivhmU/HNkdKnwK1l0Q==", "user"=>{"html5"=>"1", "css3"=>"1", "ruby"=>"1", "python"=>"1", "javscript"=>"0", "jquery"=>"0", "php"=>"0"}, "commit"=>"Submit"}
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
Rendered dashboard/index.html.erb within layouts/application (5.1ms)
Completed 200 OK in 153ms (Views: 152.0ms | ActiveRecord: 0.1ms)
编辑继承人的形式:
<%=form_for (:user) do |f| %>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-2">
<%= f.check_box :html5%> <%= f.label :html5, "Html 5" %>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-2">
<%= f.check_box :css3%> <%= f.label :css3, "CSS 3" %>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-2">
<%= f.check_box :ruby%> <%= f.label :ruby %>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-2">
<%= f.check_box :python%> <%= f.label :python %>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-2">
<%= f.check_box :javscript%> <%= f.label :javascript %>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-2">
<%= f.check_box :jquery%> <%= f.label :jquery, "jQuery" %>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-2">
<%= f.check_box :php%> <%= f.label :php, "PHP" %>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-2">
<%= f.submit "Submit", class: 'btn btn-primary' %>
</div>
</div>
<% end %>