Is there any way that I can, or am I going about this completely wrong?I found this "Date validation" that discusses the problem but it never was resolved.
Validating dates in rails
For example, it may be important to your application to ensure that every user provides a valid email address and mailing address.
Model-level validations are the best way to ensure that only valid data is saved into your database.
So using validates_date means all values are compared as dates.
The plugin adds date/time validation to Active Model for any ORM/ODM that supports the Active Model validations component.
'pm' validates_datetime - validate value as a full date and time validates - use the :timeliness key and set the type in the hash.:is_at - Attribute must be equal to value to be valid :before - Attribute must be before this value to be valid :on_or_before - Attribute must be equal to or before this value to be valid :after - Attribute must be after this value to be valid :on_or_after - Attribute must be equal to or after this value to be valid :between - Attribute must be between the values to be valid.
Range or Array of 2 values.:allow_nil - Allow a nil value to be valid :allow_blank - Allows a nil or empty string value to be valid :if - Execute validation when :if evaluates true :unless - Execute validation when :unless evaluates false :on - Specify validation context e.g :save, :create or :update. When an attribute value is compared to temporal restrictions, they are compared as the same type as the validation method type.
Before we dig into more details, let's talk about how validations fit into the big picture of your application.
Validations are used to ensure that only valid data is saved into your database.
For example, if I enter February 31st 2009 in my view, when I use in my controller, it converts it to "March 3rd 2009", which my model then sees as a valid date, which it is, but it is incorrect.
I would like to be able to do this validation in my model.
This question is currently one of the top Google results for Rails date validation.