Topic: can't insert date to mysql

Hi, I'm a newbie for rails and my English is a bit.
I'm creating forum to communicate my friends who study the same university.
My problem is when I test for comment, I fill message, post by and date.
The page shows message and post by but it does not show date.
Then, I looked in mysql, date column blanked
I'd like to know why and how to solve this problem.
Thank you

Re: can't insert date to mysql

If the date is just reflecting when the record was created then I recommend using rails' 'magic' created_at field name in your tables..

In your migration file make a column with the name 'created_at'

t.column :created_at, :datetime

Then, ActiveRecord will automatically fill this in when you save a record.

If you want to be able to choose a particular date, have a look in the rails api for the date_select helper and use it with a column in your database which is set to 'datetime' like the example above.

Last edited by idlefingers (2006-11-19 08:33:42)