We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As posted as comment for closed issue #38, this code is not working:
My whole validation looks like: validates_date :end_date, :on_or_after => :start_date, :on_or_before => lambda { |r| r.start_date + 90.days }, :unless => "start_date.blank?"
But dates that are more than 90 days in the future are accepted.
The text was updated successfully, but these errors were encountered:
The validation will only work if the start_date has a value.
Also, remove and the :unless and use :allow_blank => true.
If you can't get it working I need you provide a test case with example input data.
Sorry, something went wrong.
Got it working, it was a stupid one:
validates_date :end_date, :on_or_after => :start_date, :on_or_before => lambda { |c| c.start_date.to_date + 90.days }, :allow_blank => true
Problem was, that my model has no database attached, so the start date field has no type. I had to convert it to a date and it works...
Thanks a lot!
No branches or pull requests
As posted as comment for closed issue #38, this code is not working:
My whole validation looks like:
validates_date :end_date,
:on_or_after => :start_date,
:on_or_before => lambda { |r| r.start_date + 90.days },
:unless => "start_date.blank?"
But dates that are more than 90 days in the future are accepted.
The text was updated successfully, but these errors were encountered: