It throws an error b/c it's trying to insert NULL for event_date in the
MYSQL database:
ActiveRecord::StatementInvalid (Mysql::Error: Column 'event_date' cannot
be null: INSERT INTO `activities` (`update\
d_at`, `location_id`, `user_id`, `event_date`, `created_at`)
VALUES('2008-07-30 05:16:00', 1, 1, NULL, '2008-07-30 \
05:16:00')):
I have no idea why. If I explicitly print out 'activity.event_date.to_s'
is gives me the date of today.
If I remove the stipulation the "event_date" can be NULL it just insert
a NULL value.
It throws an error b/c it's trying to insert NULL for event_date in the
MYSQL database:
ActiveRecord::StatementInvalid (Mysql::Error: Column 'event_date' cannot
be null: INSERT INTO `activities` (`update\
d_at`, `location_id`, `user_id`, `event_date`, `created_at`)
VALUES('2008-07-30 05:16:00', 1, 1, NULL, '2008-07-30 \
05:16:00')):
I have no idea why. If I explicitly print out 'activity.event_date.to_s'
is gives me the date of today.
If I remove the stipulation the "event_date" can be NULL it just insert
a NULL value.
thanks in advance for help
datetime is a Time, not a Date. Try activity.event_date = Time.now.