Skip to content
New issue

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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle when the passed value is not a Date value. when it's a Numeric #230

Open
eng-Abdurhman opened this issue Feb 8, 2023 · 0 comments

Comments

@eng-Abdurhman
Copy link

eng-Abdurhman commented Feb 8, 2023

When the passed value is not a date. when it is a Numeric, then we get the following exception 馃憞
=> NoMethodError: undefined method "to_date" for 444:Integer


Example:
# app/models/item.rb

validates_date :expire_date

# console:

> item = Item.new(expire_date: 444)
> item.valid?
NoMethodError: undefined method `to_date' for 444:Integer

Can anyone help with this?


The suggested fix to handle Numeric values is: #229

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant