I have wrote an validation function for checking that my starting date
should be greater than the current date as like
validate :start_date_should_not_be_greater_than_current_date
def start_date_should_not_be_greater_than_current_date
if self.start_date > Date.today
errors.add("Whatever")
end
end
But the problem is that when i left empty the field for start_date when
filling values in form, this error is coming:-
----
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.>
----
I have also wrote some exceptions for my methods but these exceptions
are not catching this error.
Can you guys tell me how to tackle with this situation..
--
Posted via http://www.ruby-forum.com/.
--
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.