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

greater_than validator with dynamic value is being ommited #122

Closed
MistarzJan opened this issue Jun 14, 2021 · 2 comments
Closed

greater_than validator with dynamic value is being ommited #122

MistarzJan opened this issue Jun 14, 2021 · 2 comments

Comments

@MistarzJan
Copy link

MistarzJan commented Jun 14, 2021

When :greater_than matcher is given in validates_numericality and the value is taken from model (f.e. column) client side validation doesn't consider it as viable varbiable and ommits this validation

how to reproduce:

add validation in your model, on integer :column_name, and add :another_column, also with integer value

validates_numericality of :column_name, greater_than_or_equal_to: :another_column_name

What should happen:

Validation should consider dynamic validation, as does simple form after form submit

What happens:

Validator ommits given value, and does not validate the field. If the value in model is specified as:

  validates_numericality_of :quantity, greater_than_or_equal_to: 10

it works like a charm, however it does not help me in my usecase

System configuration*

6.0.3.4

Ruby version:
2.7.2

Client Side Validations version:
15.0

Client Side Validations Simple Form version:
13.0.0

Code snippet from your model of the validations*

  validates_numericality_of :quantity, greater_than_or_equal_to: :reserved_quantity
@MistarzJan MistarzJan changed the title When :greater_than matcher is given in validates_numericality and the value is taken from model (f.e. column) client side validation doesn't consider it as viable varbiable and ommits this validation :greater_than validator with dynamic value is being ommited Jun 14, 2021
@MistarzJan MistarzJan changed the title :greater_than validator with dynamic value is being ommited greater_than validator with dynamic value is being ommited Jun 14, 2021
@tagliala
Copy link
Contributor

tagliala commented Jun 14, 2021

Hi, thanks for being part of the CSV community.

I think this issue should belong to the main CSV repository, but I also think it is a duplicate of DavyJonesLocker/client_side_validations#687

Workaround: DavyJonesLocker/client_side_validations#687 (comment)

My answer here: DavyJonesLocker/client_side_validations#687 (comment)

Closing here, but feel free to comment if I'm wrong

@MistarzJan
Copy link
Author

MistarzJan commented Jun 14, 2021

Thanks for a fast response!, I've seen that issue, however I was wondering if it still applies when value I'am comparing to is persisted? (in this case :another_column is already in my db and it's not writable by user)

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

No branches or pull requests

2 participants