Hi, I''m trying to use ParseDate within a for loop but I get this error: can''t dup NilClass Any suggestions for making this work? Thanks, -Jason
Jason, That''s not nearly enough info for anyone to help with your problem. Parsedate, of course, works just the same whether it''s in a for loop or not. Try posting some actual code. Cheers, Pete Yandell http://9cays.com/ On 22/05/2006, at 9:36 AM, Jason Gilstrap wrote:> Hi, > > I''m trying to use ParseDate within a for loop but I get this error: > > can''t dup NilClass > > > Any suggestions for making this work? > > Thanks, > -Jason > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
for res in @response date1 = Date.today date2 = ParseDate.parsedate(date_from_string) if (date1 - date2 <= 365) count1 += 1 end end On 5/21/06, Pete Yandell <pete@notahat.com> wrote:> Jason, > > That''s not nearly enough info for anyone to help with your problem. > Parsedate, of course, works just the same whether it''s in a for loop > or not. Try posting some actual code. > > Cheers, > > Pete Yandell > http://9cays.com/ > > On 22/05/2006, at 9:36 AM, Jason Gilstrap wrote: > > > Hi, > > > > I''m trying to use ParseDate within a for loop but I get this error: > > > > can''t dup NilClass > > > > > > Any suggestions for making this work? > > > > Thanks, > > -Jason > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
The thing that''s likely to be causing your error is that date_from_string is nil. (There are also several other problems with your code, but I''ll let you cross those bridges as you come to them.) Pete Yandell http://9cays.com/ On 22/05/2006, at 1:04 PM, Jason Gilstrap wrote:> for res in @response > date1 = Date.today > date2 = ParseDate.parsedate(date_from_string) > > if (date1 - date2 <= 365) > count1 += 1 > end > end > > On 5/21/06, Pete Yandell <pete@notahat.com> wrote: >> Jason, >> >> That''s not nearly enough info for anyone to help with your problem. >> Parsedate, of course, works just the same whether it''s in a for loop >> or not. Try posting some actual code. >> >> Cheers, >> >> Pete Yandell >> http://9cays.com/ >> >> On 22/05/2006, at 9:36 AM, Jason Gilstrap wrote: >> >> > Hi, >> > >> > I''m trying to use ParseDate within a for loop but I get this error: >> > >> > can''t dup NilClass >> > >> > >> > Any suggestions for making this work? >> > >> > Thanks, >> > -Jason >> > _______________________________________________ >> > Rails mailing list >> > Rails@lists.rubyonrails.org >> > http://lists.rubyonrails.org/mailman/listinfo/rails >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails