我有以下内容form_for
<div class="multiple_students">
<%= f.label :multiple_classes, "Do you teach multiple classes?" %>
<%= f.radio_button :multiple_classes, 1, checked: @user.multiple_classes?, class: 'multiple_classes', data: { question: 'What is your average class size?' } %> <%= f.label :multiple_classes, "Yes", class: 'multiple_classes' %>
<%= f.radio_button :multiple_classes, 0, checked: @user.multiple_classes?, class: 'multiple_classes', data: { question: 'How many kids do you teach?' } %> <%= f.label :multiple_classes, "No", class: 'multiple_classes' %>
</div>
<div class="number_of_students hide">
<%= f.label :students %>
<%= f.text_field :students, :class=>"student_count required digits" %>
</div>
出于某种原因,即使multiple_classes
在数据库中选择了用户的属性为真(在数据库multiple_classes
中是布尔类型),也始终检查“否”