I am having a problem with ActiveRecord inserting the DATETIME as per the documentation; "Active Record automatically timestamps create and update operations if the table has fields named created_at/created_on or updated_at/updated_on." I have a column named created_at but ActiveRecord is not inserting the DATETIME. My insert query looks as follows:
def add_record(server_id, backup_type)
Record.create(:server_id => server_id, :backup_type => backup_type)
end
I know I could insert the time using something like
:created_at => "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")}"
The reason that I want to stay away from that is due to differences in time between the servers, both locally and geographically. I am wondering if there is a way to run the type in the same create method, such as:
def add_record(server_id, backup_type)
Record.create(:server_id => server_id, :backup_type => backup_type, created_at => DATETIME())
end
Thank you.