下面是我的mysql表定义
class CreateStudinfors < ActiveRecord::Migration
def change
create_table :studinfors do |t|
t.string :cname , limit: 45, :null => false
t.string :ename , limit: 45, :null => false
t.date :birthday
t.string :gender , limit: 1, :null => false
t.string :address , limit: 45, :null => false
t.string :telephone , limit: 45, :null => false
t.string :mobile_phone , limit: 45, :null => false
t.string :school , limit: 45, :null => false
t.string :email , limit: 45, :null => false
t.boolean :work
t.boolean :study
t.boolean :travel
t.boolean :lifeplan
t.text :other , :null => false
t.string :sales , limit: 45, :null => false
t.string :introduce , limit: 45, :null => false
t.timestamps
end
end
end
这是我表格中的一部分..
<div class="field">
<%= f.label :make select %><br />
<%= check_box_tag "work" %>
</div>
任何建议?谢谢,请
答案 0 :(得分:0)
你能否出示你的表格?如果它是特定模型的表单,例如:
<%= form_for @studinfor do |f| %>
<% end %>
然后您需要创建如下所示的复选框:
<%= form_for @studinfor do |f| %>
<%= f.checkbox :work %>
<% end %>