HI All, I have a model that uses custom validation. The validation works from the browser but RSPEC gives it an error. It looks to me like RSPEC isn''t seeing the start_time and end_time fields in my model. If I change line 9 in my validation to something like "unless title =title" I don''t have any problem. The issues seems to be with date fields. I suspect this is a bug but since I''m new to RSPEC I''d like advice before reporting it. Here is the error from rspec: You have a nil object when you didn''t expect it! The error occurred while evaluating nil.< /home/leo/railsprojects/trunk/memorymap/app/models/event.rb:9:in `valid_dates?'' /home/leo/railsprojects/trunk/memorymap/spec/models/event_spec.rb: 24: 7 8 def valid_dates? 9 unless start_time < end_time 10 errors.add("End Time must be later than Start Time") 11 end Here is my model: 1 class Event < ActiveRecord::Base 2 validates_presence_of :title, :description, :start_time, :end_time 3 validates_uniqueness_of :title 4 validate_on_create :valid_dates? 5 6 private 7 8 def valid_dates? 9 unless start_time < end_time 10 errors.add("End Time must be later than Start Time") 11 end 12 end 13 end --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---