Fork me on GitHub

Adding Date and Time Formats

2006-12-05

This is nothing new, but, having seen enough Rails developers using custom helpers to do the same thing, I thought it might warrant a quick tip.

If you’re entering dates/times in your fixtures, you’re probably familiar with this trick:

  ---
  item1:
    id: 1
    name: foo
    created_at: <%= 3.days.ago.to_s(:db) %>

Discussion