ryan heath
2006-Mar-04 03:55 UTC
[Rails] Saving current date/time upon comment submission - help!
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? -- Posted via http://www.ruby-forum.com/.
Sebastian Friedrich
2006-Mar-04 04:21 UTC
[Rails] Saving current date/time upon comment submission - help!
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 On Mar 3, 2006, at 9:55 PM, ryan heath wrote:> 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? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >