Mongoid Permalink Extension

Build Status Gem Version Coverage Status

A Mongoid field extension that stores any String as a permalink slug.

  • converts spaces to hyphens
  • converts to camel case
  • converts all dashes to hyphens
  • remove non-alphanumeric characters
  • removes accents


Add this line to your application's Gemfile:

gem 'mongoid_permalink_extension'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mongoid_permalink_extension


Add to Mongoid models as:

field :permalink, type: MongoidPermalinkExtension::Permalink

Produces slugs in the form of:


See tests for more examples.


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request