Forum: Ruby on Rails Array of dates/times from till nextweek

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Steven D. (Guest)
on 2006-04-25 17:19

I would like to make @dates in my controller.
I tried the following:

startdate =
enddate = startdate.next_week
for enddate > startdate
   @dates << startdate
   startdate = startdate.tomorrow

But I get an errormessage when I check the syntax:
"warning: useless use of a variable in void context"



Chris T (Guest)
on 2006-04-25 21:26
(Received via mailing list)
Still fairly newbish on rails but have you tried turning them into date
objects (to_date). Also depending on how it's being used could you
always make a range:

or even turn this into an array


So i think (working this out as I go along) you could prob do

@dates = (

which seems to work.

Hope this helps
This topic is locked and can not be replied to.