DavyJonesLocker / DavyJonesLocker/client_side_validations

Numericality validator against other fields doesn't work as expected

Open
#687 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature help wanted javascript
Dominant language
Ruby
Stars
2.7k
Forks
395
Avg merge
3m
Merged PRs (30d)
1

Description

When using numericality: greater_than with other model attributes, if i remove 1 of the fields, it doesn't show any messages anymore, but when i try to submit, i'm getting server validation fail. I suppose it's better to reproduce server side behaviour for that case

validates :maximum_players,
allow_nil: true,
numericality: { only_integer: true, less_than_or_equal_to: 2147483647, greater_than_or_equal_to: :minimum_players }

validates :minimum_players,
allow_nil: true,
numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: :maximum_players }

8565d634-be36-11e6-8020-e983915200e4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Reproduce the two-field model validation shown, focusing on numericality comparisons against the other attribute when one field is removed, then compare client-side messages with the server validation result. Done means the client-side behavior matches the server-side failure case, with coverage for both fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
backend, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.