MySQL created_at time information missing
Reported by Sam Smoot | November 5th, 2007 @ 03:37 PM | in 0.2.4 Release
A created_at property on a model means the model gets a before_create filter that automatically sets the current timestamp on a database record before it's saved. When the database backend is MySQL (tested on MySQL 5.x on OS X 10.4), the date value is set appropriately but the time is always 00:00:00.
The value in memory after the save is correct (includes time) and when Sqlite is used in place of MySQL, the value is correct. This would seem to indicate that it's something in the MySQL driver itself.
Comments and changes to this ticket
-

Yehuda Katz November 6th, 2007 @ 03:15 AM
This has to do with this:
def quote_time(value) "DATE('#{value.xmlschema}')" end def quote_datetime(value) "DATE('#{value}')" end def quote_date(value) "DATE('#{value.strftime("%Y-%m-%d")}')" endAs you can see, we're snipping out just the DATE for time and datetime, which is very incorrect. Unfortunately, modifying these breaks existing tests.
-

Yehuda Katz November 6th, 2007 @ 03:17 AM
- → Assigned user changed from to Sam Smoot
-
Nick Plante November 7th, 2007 @ 08:58 AM
- → State changed from new to open
- → Milestone changed from to 0.2.4 Release
-
Nick Plante November 7th, 2007 @ 03:08 PM
- → State changed from open to resolved
- → Assigned user changed from Sam Smoot to Nick Plante
Fixed, and existing tests pass. Using TIMESTAMP() for both datetime and time columns in MySQL.
-
Nick Plante November 7th, 2007 @ 03:15 PM
- → State changed from resolved to open
needs to be applied. don't have commit rights :-)
-
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
