Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Generates a URL slug/permalink based on fields in a Mongoid-based model

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
.rspec
Gemfile
LICENSE
README.rdoc
Rakefile
VERSION
mongoid_slug.gemspec

README.rdoc

Mongoid Slug

This gem generates a URL slug/permalink based on fields in a Mongoid model.

class Book
  include Mongoid::Document
  include Mongoid::Slug
  field :title
  slug  :title
end

>> book = Book.create(:title => "A Thousand Plateaus")
>> book.to_param
"a-thousand-plateaus"
>> book.update_attributes(:title => "Anti Oedipus")
>> book.to_param
"anti-oedipus"
>> Book.find_by_slug("anti-oedipus")
#<Book _id: 4c23b1f7faa4a7479a000009, slug: "anti-oedipus", title: "Anti Oedipus">
Something went wrong with that request. Please try again.