Validate Date in Rails before it hits the database
I need to validate two dates that come from create new record form. Right
now the form has drop downs for year, date, month, hour, minute. In the
controller, I need to validate that the start date is not greater than end
date and it will not let me compare it using the params[:start_date] >
params[:end_date].
How can I properly validate that the start date is not larger than the end
date when adding a new record to the database, I should be doing this in
the model but I cannot figure out how you do it. Does anyone here has any
examples I can look from?
No comments:
Post a Comment