Sunday, May 27, 2007

more reasons to love ruby on rails




Sometimes, Ruby on Rails just rocks. This is one of my fixture files for a new Day class that I'm developing. The fixture file lets me write all my tests and specs out so that the dates they reference keep up with the current date.


two_days_ago:
id: 1
date: <%= Time.now.yesterday.yesterday %>
yesterday:
id: 2
date: <%= Time.now.yesterday %>
today:
id: 3
date: <%= Time.now %>
tomorrow:
id: 4
date: <%= Time.now.tomorrow %>
next_day:
id: 5
date: <%= Time.now.tomorrow.tomorrow %>