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

Can't overwrite validate.validators.numericality.options.message #145

Closed
nitriques opened this issue Jul 22, 2016 · 7 comments
Closed

Can't overwrite validate.validators.numericality.options.message #145

nitriques opened this issue Jul 22, 2016 · 7 comments
Labels
bug
Milestone

Comments

@nitriques
Copy link

@nitriques nitriques commented Jul 22, 2016

if I set a value to validate.validators.numericality.options.message, you can't customize the message when validating, using message or notValid. I would expect to still be able to provide custom messages event if I set a default one. This problem looks specific to the numericality validator, as I do not have this problem with the 'presence' validator.

I've tried to set the message in both the constraints and option object, without any luck

This is using the validate.single function.

@nitriques
Copy link
Author

@nitriques nitriques commented Jul 22, 2016

Here's a fiddle with the P.O.C

https://jsfiddle.net/nitriques/4d9p3ju9/3/

As if you remove all other properties except message in the constraint, overwriting works. But if you add onlyInteger or greaterThan, it stops working.

@nitriques
Copy link
Author

@nitriques nitriques commented Jul 22, 2016

The fiddle is using the edge version

@ansman
Copy link
Owner

@ansman ansman commented Aug 9, 2016

This is definitely a bug, nice catch.

@ansman ansman added the bug label Aug 9, 2016
@ansman ansman added this to the Next milestone Aug 9, 2016
@ansman ansman closed this in 2ad92f5 Aug 9, 2016
@ansman
Copy link
Owner

@ansman ansman commented Aug 9, 2016

Using the edge version you can now set validate.validators.numericality.message (note that you don't set the options, just the message)

@nitriques
Copy link
Author

@nitriques nitriques commented Aug 26, 2016

Hum my fiddle still does not works... I am missing something ?

@ansman
Copy link
Owner

@ansman ansman commented Nov 5, 2016

Released in 0.11.0

@nitriques
Copy link
Author

@nitriques nitriques commented Nov 17, 2016

Thanks!

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

Successfully merging a pull request may close this issue.

None yet
2 participants