I need to add multiple different start_time and end_time dates to this model:
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
I have tried:
class Course < ActiveRecord::Base
serialize :start_time
serialize :end_time
end
But I get nil in console when trying Course.new(start_time: ['2014-12-01 00:00:00 UTC', '2014-11-01 00:00:00 UTC']). I have also tried different formats for the dates without success.
How can I achieve this?
Stringtype objects tostart_time, which isDateTimetype.Do:
and pass appropriate type:
newandcreate.You have to either use:
or