-
Notifications
You must be signed in to change notification settings - Fork 164
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
Abandoning slugs while keeping slug history #250
Comments
I would remove mongoid-slug and add Does that help? |
It's definitely a good solution. I guess I was hoping for a built-in mechanism to achieve this kind of behavior. Like a "disabled" flag that you can set on the slug field so that the reverse lookup would still work, but the default id field gets served as the slug from now on. But probably my case is not common enough to warrant an option like that. The problem for me with your solution is that I'm hesitant to add extra code just to achieve this behavior. So if there is no built-in solution, I am tending towards simply disabling the slugs and having to live with the lost history, whatever repercussions that may entail with Google. |
Feel free to PR something that accomplishes that. Instead of a disabled function I would want to split up the Other than above, you can roll your own Mongoid::Slug that just implements the |
This is more of a question regarding a best/good practice than an issue.
I've been using mongoid_slugs for a while on my website. Now I would like to remove them and to switch back to using the db ids. I could remove the slugs keyword and the include statement from my model to get the result I want. But this would make me lose my slug history, which I don't want, as that could have unforseen negative consequences with Google.
What's the best practice for abandoning slugs while keeping the slug history?
I tried using
slug :id, history: true
but this suffixes my slugs with -158519083934c2b39e6c49a73-1
, as it should if the id is in the slug table by default - although it does not get listed ondocument.slugs
. What I am looking for is a way to tell mongoid_slug to use the id as the slug, instead of the last item of the slugs array.The text was updated successfully, but these errors were encountered: