Created
December 1, 2010 21:26
-
-
Save dougalcorn/724257 to your computer and use it in GitHub Desktop.
initializing hash with default values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = [] | |
((90.days.ago.to_date)..Date.today).each do |date| | |
date = date.to_formatted_s(:db) | |
value = db_data.has_key?(date) ? db_data[date] : 0 | |
data << [date, value] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment