Rails: always include the milliseconds with created_at for every model

Viewed 5172

How do I modify my Rails app to always include the milliseconds information with the created_at field of my models?

This question has the answer for how to do it for an individual model, but I want to do it globally.


For example, when I retrieve all my Item models (by hitting /items with a GET), I get the following JSON:

[{"created_at":"2011-08-07T23:42:15Z","updated_at":"2011-08-07T23:42:15Z","id":180,"user_id":6,"content":"test"}]

But note that the created_at field doesn't have any information about the millisecond that it was created. How do I include that for all my models?

3 Answers
Related