Iterating over days in Ruby

Viewed 4875

I've tried the following:

def next_seven_days
  today = Date.today
  (today .. today + 7).each { |date| puts date } 
end 

But this just gives me the first and last date. I can't figure out how to get all the ones in between.

I was trying to follow the example here: http://www.whynotwiki.com/Ruby_/_Dates_and_times

5 Answers
Related