Array of dates/times from till nextweek


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”




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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs