On 27 July 2011 03:38, sol.manager <[email protected]> wrote: > I have a "job" model for adding job experiences to a resume and am > seeing the following error on occasion: > > NoMethodError: undefined method `>' for nil:NilClass > > The line of code throwing the error is: if self.started_on > > self.ended_on
That means started_on is nil. > > > The code for this portion of the job form view is: > <label>Date started *</label> > Start: <%= f.date_select :started_on, :order => > [:month, :year], :start_year=>1970, :include_blank=>true %> > <br/> > <label>Date ended *</label> > Stop: <%= f.date_select :ended_on, :order => > [:month, :year], :start_year=>1970, :include_blank=>true %> > <br> > Hint: leave blank for current position > > > The relevant code from the job model is: > def validate > unless self.ended_on.nil? > if self.started_on > self.ended_on I guess you have the situation where ended_on is not nil but started_on is. If you don't think this should be happening then have a look at the Rails Guide on debugging to find out how to use ruby-debug to break into the code and inspect data. Colin -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

