Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

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
Milestone

Comments

@nitriques
Copy link

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

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

The fiddle is using the edge version

@ansman
Copy link
Owner

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 as completed in 2ad92f5 Aug 9, 2016
@ansman
Copy link
Owner

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

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

@ansman
Copy link
Owner

ansman commented Nov 5, 2016

Released in 0.11.0

@nitriques
Copy link
Author

Thanks!

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

No branches or pull requests

2 participants