Timestamp Your Models

October 03, 2009

Should this model have a timestamp?

When in doubt, timestamp your models. When not in doubt, timestamp it anyway.

Because it's handy. While working on this site, someone accidentally generated duplicated games. I previously created those games two weeks earlier. I needed to removes games that were created within the last 24 hours. Timestamp to the rescue!

Game.delete_all([created_at > 1.day.ago])

Problem solved!

blog comments powered by Disqus

© 2011 Rit Li