Slugged

About

Support for slug history (e.g. if a users slug changes, it will record the old slug)

Simple defaulting for slugs to UUID's (to avoid showing ID's.)

Built on ActiveRecord 3.0

If stringex is installed, uses stringex's transliteration stuff

Slugged used to be called Pseudocephalopod - a name inspired by the Jason Wander series of
books which I just happened to be reading when I had the need for this that focuses on a
war with slug-like creatures.

Why?

I love the idea of friendly_id, and most of the implementation but it felt bloated
to me and my experiences on getting it to work correctly with Rails 3 left a base taste
in my mouth / was altogether hacky.

Slugged is very much inspired by friendly id but with a much simpler codebase
and built to work on Rails 3 from the start.

Usage

Using Slugged is simple. In Rails, simply drop this in your Gemfile:

gem'slugged','~> 2.0'

Optionally restricting the version.

Next, if you wish to use slug history run:

$ rails generate slugged:slugs

Otherwise, when calling is_sluggable make sure to include :history => false

Next, you need to add a cached slug column to your model and add an index. In your migration,
you'd usually want something like:

add_column:users,:cached_slug,:stringadd_index:users,:cached_slug

Or, using our build in generator:

$ rails generate slugged:slug_migration Model

Lastly, in your model, call is_sluggable:

classUseris_sluggable:nameend

is_sluggable accepts the source method name as a symbol, and an optional has of options including: