我需要多个不同start_time
和end_time
日期添加到这个模型:轨道4多个日期范围出现在一个记录
class CreateCourses < ActiveRecord::Migration
def change
create_table :courses do |t|
t.string :name
t.datetime :start_time
t.datetime :end_time
t.timestamps
end
end
end
我曾尝试:
class Course < ActiveRecord::Base
serialize :start_time
serialize :end_time
end
但我在控制台得到nil
尝试Course.new(start_time: ['2014-12-01 00:00:00 UTC', '2014-11-01 00:00:00 UTC'])
。我也尝试过不同格式的日期,但没有成功。
我该如何做到这一点?
它是怎么去?你有没有解决它? – 2014-11-21 14:18:49