While I was happily creating a fixture to test my newly created Article model, I found out that the <%= Time.now %> that I used in the fixture was dumping nil’s into the db. ;-(
That was suppose to work, at least long time ago… I still recall reading the first Rails book… The rails api didn’t say much about the dates in dynamic fixtures…
Well, let’s be a little skeptical, and say… Time.now.strftime(“%Y-%m-%d %H:%M:%S”).
Ha! It worked!
But it’s a kinda too long…
Hum… what else does google has to offer?
There was a ticket open with the same issue: Time.now in a fixture return nil. Guess I am not the first ;-)
<%= Time.now.to_s(:db) %>
There, this is much prettier ;-)
Oh, here is a bonus link for more Dynamic Fixture stuff!
- Update: Formatting Time