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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added custom error message for validate_numeric and validate_size_of … #670

Merged

Conversation

vishalsodani
Copy link
Contributor

#666

src/avram/validations.cr Outdated Show resolved Hide resolved
@@ -143,11 +144,11 @@ module Avram::Validations
size = attribute.value.to_s.size

if !min.nil? && size < min
attribute.add_error "is too short"
attribute.add_error message
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These still need to have the same changes as you did below, then it will be good 👍

Copy link
Member

@matthewmcgarvey matthewmcgarvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! 🎉🎉🎉

@vishalsodani
Copy link
Contributor Author

Nice job! tadatadatada

Thanks!

@matthewmcgarvey
Copy link
Member

@vishalsodani woops, didn't realize that the CI wasn't running. Could you go ahead and tell ameba to ignore those issues? I might try to figure out how to fix them later but it's overkill for this change

Here's docs on how to do it https://github.com/crystal-ameba/ameba#inline-disabling

@vishalsodani
Copy link
Contributor Author

@vishalsodani woops, didn't realize that the CI wasn't running. Could you go ahead and tell ameba to ignore those issues? I might try to figure out how to fix them later but it's overkill for this change

Here's docs on how to do it https://github.com/crystal-ameba/ameba#inline-disabling

I added the ignore comments.

@matthewmcgarvey
Copy link
Member

Looks like the disabling didn't get put in the right place. You should be able to check it locally with bin/ameba (it's generated with shards install)

@vishalsodani
Copy link
Contributor Author

Looks like the disabling didn't get put in the right place. You should be able to check it locally with bin/ameba (it's generated with shards install)

Thanks for the hint. Fixed.

@matthewmcgarvey matthewmcgarvey linked an issue Apr 30, 2021 that may be closed by this pull request
@matthewmcgarvey matthewmcgarvey merged commit 5b9be21 into luckyframework:master Apr 30, 2021
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

Successfully merging this pull request may close these issues.

Custom error messages for all validations
2 participants