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
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