Sutto / slugged

Super simple slugs for ActiveRecord 3+, with slug history. Formerly known as Pseudocephalopod.
MIT License
86 stars 16 forks source link

Generating new slugs doesn't check uniqueness against slug history #16

Open martinraie opened 12 years ago

martinraie commented 12 years ago

Slugged.next_value method only checks if any of the records already has the same slug (cached_slug) but it doesn't check if some recored has had the slug previously (slug history).

Sutto commented 12 years ago

Yehp - that's intended. The idea is that history should only be valid until someone overrides it.

martinraie commented 12 years ago

Ok. I didn't know that.

Although it doesn't make sense to me that someone else can override my old url. I think that when my old url continues working after rename, it shouldn't stop working at some arbitrary moment.

Maybe there could be an option where we could specify which behavior we expect from our slug history?

Sutto commented 12 years ago

Yup, that makes a lot of sense - I don't have time to do it at the moment personally, but I'd be more than happy to accept a pull request implementing it if you're willing / able to do that. If not, I can probably organise some time in the near future to do so?

My current thought is that something along the lines of immutable_history or the like - not sure how well that describes the intention though?

martinraie commented 12 years ago

I checked the code but I'm afraid it currently takes too much time for me to study all the inner workings of Slugged. I'll get back to it when I have more time.

Sutto commented 11 years ago

@martinraie Still want this feature? If so, I'll take a look at implementing it this weekend. Cheers!

martinraie commented 11 years ago

Sorry, I was out of office and couldn't reply earlier.

I had one specific use case where lack of this option was very noticeable. I made a quick workaround for this use case so the problem is currently not disturbing me too much. But I'd still appreciate if I could use this option.