I’m having some trouble getting a model to save a date_time attribute.
The attribute is of class DateTime, whereas the class of the object I am trying to save is Time.
Is it possible to save a Time object in a DateTime attribute?
This is how it looks in Schema.rb:
create_table "tables", :force => true do |t|
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "time_spot"
end
You don’t actually have to do any manipulation to save a Time object in a DateTime field. ActiveRecord will store the Time object in the proper SQL format. For example: