Forum: Ruby on Rails Saving current date/time upon comment submission - help!

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1e2dd87a31c5d3e07adc9efa375f4dc4?d=identicon&s=25 ry an (hreyaatnh)
on 2006-03-04 04:55
I'm having trouble storing the date/time with my comments - I'm getting
the MySQL error "posted_at is null".

How do I setup my code to automatically store the current date/time in
the 'posted_at' column of my 'comments' table?
10c741d575988433e3fcd04133f3c462?d=identicon&s=25 Sebastian Friedrich (Guest)
on 2006-03-04 05:24
(Received via mailing list)
Rename the column created_at instead of posted_at and this behavior
will automatically be turned on (make sure column is DATETIME not
TIMESTAMP). Otherwise have a look at this article on how to extend
ActiveRecord to use custom "magic" timestamp columns: http://
wiki.rubyonrails.com/rails/pages/ExtendingActiveRecordExample

sebastian
This topic is locked and can not be replied to.