Project

namekuji

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Include Namekuji in your Rails models to give them friendly slug generation, with any ORM that supports ActiveModel.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 4.2.6
 Project Readme

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