From: misiek Date: 2006-01-25T08:13:12+09:00 Subject: Re: split up days Sky Yin wrote: > oops, the last line should be: > > days = (Date.new(date_start)..Date.new(date_stop)).to_a > > > On 1/24/06, Sky Yin wrote: > >>It's easy to transfer the string "year, month, day" to the parameter >>format that meets the requirement of Date.new(year, month, day) : >> >>date_start = @start.split(',').map {|x|, x.to_i} >>date_stop = @stop.split(',').map {|x|, x.to_i} >>days = (Date.new(@start)..Date.new(@stop)).to_a >> >>Still elegant? >> I got like @start = @params['start']['year'].to_s + "," + @params['start']['month'].to_s + "," + @params['start']['day'].to_s @stop = @params['stop']['year'].to_s + "," + @params['stop']['month'].to_s + "," + @params['stop']['day'].to_s and I try to put to days = (Date.new(@start)..Date.new(@stop)).to_a still got this error undefined method `-' for "2006,1,3":String BTW what is "x" => date_start = @start.split(',').map {|x|, x.to_i} ? ^ ^ or is going about (',') ? hmm because is error ../script/../config/../app/controllers/hour_controller.rb:178: parse error, unexpected ',' date_start = @start.split(',').map {|x|, x.to_i} ^