Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # 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

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

No branches or pull requests

1 participant