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

Dependent validations are not working? #25

Closed
silva96 opened this issue Jul 6, 2021 · 2 comments
Closed

Dependent validations are not working? #25

silva96 opened this issue Jul 6, 2021 · 2 comments

Comments

@silva96
Copy link

silva96 commented Jul 6, 2021

I'm trying to edit a record that was created in the normal flow of our platform (other front end), so data is correct. But trying to save it fails with this validation:

image

6 is actually greater than 4 but I can't save the record.

this is the validation in the model:

validates :min_age, numericality: {
    only_integer: true, greater_than_or_equal_to: MIN_AGE
  }
  validates :max_age, numericality: {
    only_integer: true, greater_than_or_equal_to: :min_age, less_than_or_equal_to: MAX_AGE
  }
omohokcoj added a commit that referenced this issue Jul 6, 2021
@omohokcoj
Copy link
Member

omohokcoj commented Jul 6, 2021

@silva96 thanks for reporting this.
Motor Admin tries to perform certain AR validations on the front end side and for now it's impossible to perform dependant validations on the front end. So it would be better to skip them so they can be performed on the server side.

It has been fixed in the newest version on the gem: https://rubygems.org/gems/motor-admin/versions/0.1.79

@silva96
Copy link
Author

silva96 commented Jul 6, 2021

Great thanks for the quick response! you are awesome.

@silva96 silva96 closed this as completed Jul 6, 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

No branches or pull requests

2 participants