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

Validation errors on redirect_url #1195

Closed
merqlove opened this Issue Feb 6, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@merqlove
Contributor

merqlove commented Feb 6, 2017

Incompatible with localize validation. Seems that validator runs on every value (yes, on blank too)
I have added custom REGEX & dropped check for persistence. Anyway it blank by default.
merqlove@6613a79

@did did added the issue label Mar 8, 2017

@did

This comment has been minimized.

Show comment
Hide comment
@did

did Mar 8, 2017

Member

hey @merqlove this one is tricky.The case you're describing in when you create a page in 2 languages and finally decide that it will be a redirect page. The thing is that because you posted your form, it filled a blank redirect_url in all the locales. Then, it becomes impossible to modify the redirect_url.

By default, Mongoid validates the attributes of a model in all the locales https://github.com/mongodb/mongoid/blob/master/lib/mongoid/validatable/presence.rb#L31.

I don't feel good to modify the Mongoid behavior and your patch lets editors to enter a blank redirect_url which is not acceptable.

Let me see if I can come up with a good solution.

Member

did commented Mar 8, 2017

hey @merqlove this one is tricky.The case you're describing in when you create a page in 2 languages and finally decide that it will be a redirect page. The thing is that because you posted your form, it filled a blank redirect_url in all the locales. Then, it becomes impossible to modify the redirect_url.

By default, Mongoid validates the attributes of a model in all the locales https://github.com/mongodb/mongoid/blob/master/lib/mongoid/validatable/presence.rb#L31.

I don't feel good to modify the Mongoid behavior and your patch lets editors to enter a blank redirect_url which is not acceptable.

Let me see if I can come up with a good solution.

did added a commit that referenced this issue Mar 8, 2017

fix issue #1195 (validation errors on redirect_url). From now on, val…
…idations are only applied to the value in the current locale

@did did closed this Mar 8, 2017

@merqlove

This comment has been minimized.

Show comment
Hide comment
@merqlove

merqlove Mar 8, 2017

Contributor

Yeah, i c :)
Ok, i will keep it as workaround locally till better solution.

Contributor

merqlove commented Mar 8, 2017

Yeah, i c :)
Ok, i will keep it as workaround locally till better solution.

@did

This comment has been minimized.

Show comment
Hide comment
@did

did Mar 8, 2017

Member

@menkel check out my commit 51329bb, it's working great.

Member

did commented Mar 8, 2017

@menkel check out my commit 51329bb, it's working great.

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