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

Fix/Slug Validation in unset_slug_if_invalid #903

Closed
wants to merge 1 commit into from
Closed

Fix/Slug Validation in unset_slug_if_invalid #903

wants to merge 1 commit into from

Conversation

Ancez
Copy link

@Ancez Ancez commented Apr 28, 2019

updated unset_slug_if_invalid to only validate errors for the slug field instead of all model fields.

closes #902

@stale
Copy link

stale bot commented Dec 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 11, 2019
@parndt
Copy link
Collaborator

parndt commented Dec 12, 2019

@Ancez hi! Could you please pull in the latest changes from master into this PR?

@stale stale bot removed the stale label Dec 12, 2019
@stale
Copy link

stale bot commented Jan 24, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 24, 2020
@Ancez
Copy link
Author

Ancez commented Jan 27, 2020

@Ancez hi! Could you please pull in the latest changes from master into this PR?

Will do later on today, sorry for the late response

@stale stale bot removed the stale label Jan 27, 2020
@nedenwalker
Copy link

nedenwalker commented Feb 27, 2020

Hi there @Ancez and @parndt ! We encountered the same issue today in our rails app that this PR purports to fix. We were wondering about the state of it and whether there is something we can do to help?

@parndt
Copy link
Collaborator

parndt commented Feb 27, 2020

@nedenwalker It needs rebasing against master because it's failing CI on its current HEAD.

Does the change fix your problem?

@nedenwalker
Copy link

@parndt I can confirm that the fix does eliminate the bug. When the form reloads with previous form values and error messages, the slug field is now also present.

@nedenwalker
Copy link

Wasn't sure on how to run teamcity? tests locally or rebase someone else's fork etc, so made my own fork, made the code change and submitted a new PR to get CI running in your system: #936

@nedenwalker
Copy link

Figured out local testing issue, was running bundle exec rails test, needed to instead do bundle exec rake test. I see lots of failures. Will need some time to process it all, since change was a one-liner, hopefully fix to tests is also a one liner.

@nedenwalker
Copy link

@parndt I see 5 test failures, all related to the code change. I cannot admit to understanding the coding enough, but in particular, I see one test that specifies the code should do what it used to do, ie wipe the slug when there is another field validation failure. This code change would alter that contract. https://github.com/norman/friendly_id/blob/master/test/slugged_test.rb#L95 Will leave it to you to determine if the functionality should change or not.

@Ancez
Copy link
Author

Ancez commented Mar 11, 2020

yeah there are some tests to fix otherwise this fixes the issue of the slug being removed. If you want to you can fork this line and fix the specs for it. If not then I'll fix these specs tonight if that's alright, until then I recommend changing the base within your projects Gemfile for this gem to this PR

@khng
Copy link
Contributor

khng commented Mar 26, 2020

Fixed the test and submitted a new PR here: #938.

@stale
Copy link

stale bot commented May 7, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 7, 2020
@parndt parndt closed this May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

slug being unset if model has any errors (unset_slug_if_invalid)
4 participants