Use sequence number for reserved ID instead of throwing an exception #262

Closed
davejamesmiller opened this Issue Apr 6, 2012 · 2 comments

2 participants

@davejamesmiller

Is there any way to have FriendlyId quietly append --2 to the slug name instead of triggering an error if the name is reserved? I just need to prevent it clashing with /new, but not to prevent users creating a post titled "New".

My current solution is to quietly rename it "new2" - but the code is a bit verbose, and it can end up being new2--2 if there is more than one. Is there a better solution?

Thanks

@norman
Owner

There currently is no way other than monkey patching, but I think it's a good idea. For FriendlyId 4.1 I'd like to have conflict resolution be easily configurable, and extending this to include not only used slugs, but reserved ones as well, makes sense.

@norman
Owner

Closing this for lack of followup. If anybody wants to implement this, patches are welcome.

@norman norman closed this Apr 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment