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

Allow nil on size and inclusion validations. #299

Merged
merged 7 commits into from
Feb 9, 2020
Merged

Allow nil on size and inclusion validations. #299

merged 7 commits into from
Feb 9, 2020

Conversation

wout
Copy link
Contributor

@wout wout commented Feb 8, 2020

As suggested in #293, this PR adds an allow_nil option for validate_size_of and validate_inclusion_of.

Copy link
Member

@paulcsmith paulcsmith left a comment

Choose a reason for hiding this comment

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

A couple small comments. Thanks for doing this!

spec/validations_spec.cr Outdated Show resolved Hide resolved
spec/validations_spec.cr Outdated Show resolved Hide resolved
src/avram/validations.cr Outdated Show resolved Hide resolved
@wout
Copy link
Contributor Author

wout commented Feb 9, 2020

In this proposal, the original method keeps its original shape (more or less) and an overload is created specifically for the nil scenario.

spec/validations_spec.cr Outdated Show resolved Hide resolved
@paulcsmith paulcsmith merged commit 7927e16 into luckyframework:master Feb 9, 2020
@wout wout deleted the validations-with-allow-nil branch February 9, 2020 19:51
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.

2 participants