Hi all, I have an event containing a datetime and want to see if that datetime is in the past. I have a method in event def future_event? if self.start <= DateTime.now() return true end false end on an event I can the do event.future_event? This results in You have a nil object when you didn''t expect it! The error occurred while evaluating nil.< The strange thing is that self is definatly not nil? Is this a problem with DateTime.now()? regards, Stijn --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Sep 18, 10:19 pm, Tarscher <tarsc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > This results in You have a nil object when you didn''t expect it! > The error occurred while evaluating nil.<It''s not telling you that self is nil (which as you point out it isn''t usually), it''s telling you that self.start is nil. Fred> > The strange thing is that self is definatly not nil? Is this a problem > with DateTime.now()? > > regards, > Stijn--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
self.start indeed returns a nil value but the strange this is that it is when I look at the self.attributes -> start in the debugger it is correctly filled in. Is start a name you can''t use in rails? Regards, Stijn On 18 sep, 23:21, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sep 18, 10:19 pm,Tarscher<tarsc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > This results in You have a nil object when you didn''t expect it! > > The error occurred while evaluating nil.<> > It''s not telling you that self is nil (which as you point out it isn''t > usually), it''s telling you that self.start is nil. > > Fred > > > > > The strange thing is that self is definatly not nil? Is this a problem > > with DateTime.now()? > > > regards, > > Stijn > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 19 Sep 2008, at 08:36, Tarscher <tarscher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > self.start indeed returns a nil value but the strange this is that it > is when I look at the self.attributes -> start in the debugger it is > correctly filled in. Is start a name you can''t use in rails? >Oh, you may be running into an edge case when running under the debugger. Old versions of rdebug would define their own start method. Fred> Regards, > Stijn > > On 18 sep, 23:21, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> On Sep 18, 10:19 pm,Tarscher<tarsc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >> >>> This results in You have a nil object when you didn''t expect it! >>> The error occurred while evaluating nil.<>> >> It''s not telling you that self is nil (which as you point out it >> isn''t >> usually), it''s telling you that self.start is nil. >> >> Fred >> >> >> >>> The strange thing is that self is definatly not nil? Is this a >>> problem >>> with DateTime.now()? >> >>> regards, >>> Stijn >> >> > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I changed the name of ''start'' to ''begin'' and it works now in debug. Thanks Stijn On 19 sep, 11:13, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 19 Sep 2008, at 08:36,Tarscher<tarsc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > self.start indeed returns a nil value but the strange this is that it > > is when I look at the self.attributes -> start in the debugger it is > > correctly filled in. Is start a name you can''t use in rails? > > Oh, you may be running into an edge case when running under the > debugger. Old versions of rdebug would define their own start method. > > Fred > > > Regards, > > Stijn > > > On 18 sep, 23:21, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> On Sep 18, 10:19 pm,Tarscher<tarsc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >>> This results in You have a nil object when you didn''t expect it! > >>> The error occurred while evaluating nil.<> > >> It''s not telling you that self is nil (which as you point out it > >> isn''t > >> usually), it''s telling you that self.start is nil. > > >> Fred > > >>> The strange thing is that self is definatly not nil? Is this a > >>> problem > >>> with DateTime.now()? > > >>> regards, > >>> Stijn--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---