You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a .save() method on a model which has errors on other fields (e.g. name is invalid), the slug gets set to nil but was valid. It should preserve the value after .save() on the model so the user can fix the remaining errors without having to rewrite the slug. This also leads to other errors on the slug field that may have caused the model to fail validation to be removed.
method unset_slug_if_invalid shouldn't be checking for errors.present?. Instead it should only check that the slug field has any errors (doing errors[friendly_id_config.query_field].present? solves the problem)
Hi @parndt, thank you for your reply, I've created a PR with this code change but some of the specs will need updating. This issue might not be visible when running the specs but it will become quite blunt once testing it on the website
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.
When running a .save() method on a model which has errors on other fields (e.g.
name
is invalid), theslug
gets set to nil but was valid. It should preserve the value after .save() on the model so the user can fix the remaining errors without having to rewrite the slug. This also leads to other errors on the slug field that may have caused the model to fail validation to be removed.method
unset_slug_if_invalid
shouldn't be checking forerrors.present?
. Instead it should only check that theslug
field has any errors (doingerrors[friendly_id_config.query_field].present?
solves the problem)The text was updated successfully, but these errors were encountered: