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

Uses length validation to hide add link when you reach maximum # of nested objects#243

Closed
michaelglass wants to merge 2 commits into
ryanb:masterfrom
michaelglass:length_validator
Closed

Uses length validation to hide add link when you reach maximum # of nested objects#243
michaelglass wants to merge 2 commits into
ryanb:masterfrom
michaelglass:length_validator

Conversation

@michaelglass

Copy link
Copy Markdown
Contributor

no tests yet, but this should work.

continued to implement #46, adding prototype and a few small changes:

by default, using length validators will not be used.

use length validatiors globally with

config.nested_form.use_length_validators = true

in your application.rb

use length validations on a per-association level by passing the :check_maximum option

f.link_to_add :tasks, check_maximum: true

if check_maximum is passed in but a validator can't be chosen (either because there are none or more than 1) link_to_add will raise an NestedForm::UnresolvedLengthValidator error

if you just want to set a maximum without checking a length validator, pass it in

f.link_to_add :tasks, maximum: 5

this will override any length validators

@michaelglass

Copy link
Copy Markdown
Contributor Author

... so Sebastian's thread had some activity, but here there have been crickets.

If I more thoroughly test this feature, will it get merged in?

<3

@carlosgarciaq

Copy link
Copy Markdown

I would be very interested in this feature. Hope it gets merged in. It'd be great if there was a 'minimum' check as well.

@robertwbradford

Copy link
Copy Markdown

+1 for this. Any update?

@michaelglass

Copy link
Copy Markdown
Contributor Author

assuming this is dead. closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants