ORM-agnostic slug generator for ActiveModel
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.codeclimate.yml
.gitignore
.rubocop.yml
.travis.yml
CHANGELOG.md
Gemfile
LICENSE
README.md
Rakefile
namekuji.gemspec

README.md

Namekuji

Gem Version Build Status Dependency Status Code Climate Coverage Status

ORM-agnostic slug generator for ActiveModel. Include Namekuji in your Rails models to give them friendly slug generation, with any ORM that supports ActiveModel.

How To Use

Gemfile:

gem 'namekuji'

Create a model with a string field named slug, then add two lines to it:

class Post < ActiveRecord::Base
  include Namekuji

  sluggable on_field: :title
end
p = Post.create title: "My Latest Post"
p.slug # "my-latest-post"
p.to_param # "my-latest-post"

If you don't specify an on_field, the model's to_s method will be used.

If you want to name your slug column something else:

sluggable slug_field: :parameterized