Ruby Rails中的工作日选择器

Ruby Rails中的工作日选择器,ruby,ruby-on-rails-3,forms,simple-form,Ruby,Ruby On Rails 3,Forms,Simple Form,我有一个时间表模型,用户可以在该模型中选择一周中的小时数和特定天数(例如3hr周一、周二、周六)。我的迁移看起来像 class CreateSchedules < ActiveRecord::Migration def change create_table :schedules do |t| t.integer :hourss t.integer :user_id t.boolean :monday t.boolean :tuesday t.boolean :w

我有一个
时间表
模型,用户可以在该模型中选择一周中的小时数和特定天数(例如
3hr
周一、周二、周六
)。我的迁移看起来像

 class CreateSchedules < ActiveRecord::Migration
 def change
 create_table :schedules do |t|
  t.integer :hourss
  t.integer :user_id
  t.boolean :monday
  t.boolean :tuesday
  t.boolean :wednesday
  t.boolean :thursday
  t.boolean :friday
  t.boolean :saturday
  t.boolean :sunday

  t.timestamps
end
end
end
class CreateSchedules

如何在视图中编写表单以显示工作日的复选框,并选择一些,布尔值应设置为true。我使用的是
简单表单
和Rails 3.2.7

和简单表单,这非常简单。照办

=f.输入:星期一

=f.输入:星期二

等。简单表单自动将布尔db项转换为复选框