Hi,
I would like to make @dates in my controller.
I tried the following:
startdate = Time.now
enddate = startdate.next_week
for enddate > startdate
@dates << startdate
startdate = startdate.tomorrow
end
But I get an errormessage when I check the syntax:
“warning: useless use of a variable in void context”
Anyone?
Thanks!
Steven.
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:
(startdate.to_date…enddate.to_date)
or even turn this into an array
(startdate.to_date…enddate.to_date).to_a
So i think (working this out as I go along) you could prob do
@dates = (Time.now.to_date…Time.now.next_week.to_date).to_a
which seems to work.
Hope this helps