I have a datetime field called time in my MotionRecord model. I try to set it using this command:
MotionRecord.create({:time=> "2010-10-15 15:10:24", :chart_id=>1})
Oddly enough this results in the following input:
<MotionRecord id: 1, time: nil, chart_id: 1>
I'm not sure what I am doing wrong.
Edit: This is my model.
class MotionRecord < ActiveRecord::Base
belongs_to :chart
belongs_to :activity
attr_accessor :time
end
and my schema
create_table :motion_records do |t|
t.datetime :time
t.integer :chart_id
t.integer :activity_id
t.timestamps
end